Reading circle membership management
Members browse reading circles (book clubs), join or cancel their membership, and are automatically placed in JOINED or WAITING status based on circle capacity. Hosts and admins can close a circle, which notifies every member and promotes the next waiting member when a joined member cancels.
Document details · v1
Drift detectedlib/features/circles.mjs — This dok may no longer match the code beneath it.
User flow
5member
View the list of reading circles with their book, schedule, and seat availability
ResultThe circles grid shows each circle's title, description, book, start date, joined/capacity count, waiting count, and the member's own membership status if any
Interaction details
- all · auto
member
Join an open reading circle
ResultA membership is created with status JOINED if the circle has open seats, or WAITING if the circle is at capacity
Starts when · Member is signed in · Circle is not closed · Member is not the circle's host
Interaction details
- desktop · click
member
Cancel an existing circle membership
ResultThe membership is removed; if the removed membership was JOINED, the earliest-waiting member is automatically promoted to JOINED
Starts when · Member is signed in · Member currently holds a membership in the circle
Interaction details
- desktop · click
host
Close a hosted reading circle after confirming the action
ResultThe circle is marked closed, further joins are blocked, and every current member receives a closed-circle notification
Starts when · Host is signed in · Host owns the circle · Circle is not already closed
Interaction details
- desktop · click
admin
Close any reading circle on behalf of the platform
ResultThe circle is marked closed and every current member receives a closed-circle notification, regardless of who hosts it
Starts when · Admin is signed in · Circle is not already closed
Interaction details
- desktop · click
Business rules
4Policies and constraints the product must keep.
- 01RestrictionBR-CIRCLES-01
The host of a circle cannot join their own circle; attempting to do so is rejected with error code HOST_CANNOT_JOIN and HTTP status 409.
Rule scope and code anchor
Roles · ROLE-HOST
Linked criteria 1Criterion 02Read linked criteria here
- AC-CIRCLES-02When the host of a circle attempts to join that same circle, the request is rejected with error code HOST_CANNOT_JOIN and HTTP status 409.
- 02ValidationBR-CIRCLES-02
Joining a circle that has already been closed is rejected with error code CLUB_CLOSED and HTTP status 409.
Rule scope and code anchor
Roles · ROLE-MEMBER
Linked criteria 1Criterion 03Read linked criteria here
- AC-CIRCLES-03When a member attempts to join a circle that is already closed, the request is rejected with error code CLUB_CLOSED and HTTP status 409.
- 03CalculationBR-CIRCLES-03
When a member joins, their membership status is JOINED if the number of currently JOINED members is below the circle's capacity, otherwise WAITING. When a JOINED member cancels, the WAITING member with the lowest join sequence is promoted to JOINED.
Rule scope and code anchor
Roles · ROLE-MEMBER
Read linked criteria here
- AC-CIRCLES-01When a circle's joined-member count equals its capacity, a new join request results in membership status WAITING rather than JOINED.
- AC-CIRCLES-04When a JOINED member cancels their membership and at least one WAITING member exists, the waiting member with the lowest join sequence is automatically changed to JOINED status.
- 04PermissionBR-CIRCLES-04
Join, cancel, and close actions require an authenticated session, otherwise error code UNAUTHENTICATED with HTTP status 401 is returned. Closing a circle additionally requires the acting user to be the circle's host or an admin, otherwise error code FORBIDDEN with HTTP status 403 is returned; referencing a non-existent circle in any action returns error code NOT_FOUND with HTTP status 404.
Rule scope and code anchor
Roles · ROLE-MEMBER, ROLE-HOST, ROLE-ADMIN
Read linked criteria here
- AC-CIRCLES-05When a signed-in member who is neither the circle's host nor an admin attempts to close the circle, the request is rejected with error code FORBIDDEN and HTTP status 403.
- AC-CIRCLES-06When a join, cancel, or close request is made without a valid session, it is rejected with error code UNAUTHENTICATED and HTTP status 401.
Acceptance criteria
6Expected outcomes. These entries do not claim a test was run or passed.
- 01CriterionAC-CIRCLES-01
When a circle's joined-member count equals its capacity, a new join request results in membership status WAITING rather than JOINED.
Linked rules 1Rule 03 - 02CriterionAC-CIRCLES-02
When the host of a circle attempts to join that same circle, the request is rejected with error code HOST_CANNOT_JOIN and HTTP status 409.
Linked rules 1Rule 01 - 03CriterionAC-CIRCLES-03
When a member attempts to join a circle that is already closed, the request is rejected with error code CLUB_CLOSED and HTTP status 409.
Linked rules 1Rule 02 - 04CriterionAC-CIRCLES-04
When a JOINED member cancels their membership and at least one WAITING member exists, the waiting member with the lowest join sequence is automatically changed to JOINED status.
Linked rules 1Rule 03 - 05CriterionAC-CIRCLES-05
When a signed-in member who is neither the circle's host nor an admin attempts to close the circle, the request is rejected with error code FORBIDDEN and HTTP status 403.
Linked rules 1Rule 04 - 06CriterionAC-CIRCLES-06
When a join, cancel, or close request is made without a valid session, it is rejected with error code UNAUTHENTICATED and HTTP status 401.
Linked rules 1Rule 04
Source files 21
- page.tsx
- LeafProvider.tsx
- useLeafState.ts
- useLeafLocale.ts
- locale.ts
- layout.tsx
- headings.tsx
- store.mjs
- initial-state.mjs
- password.mjs
- action-support.ts
- domain-error.mjs
- session.mjs
- validation.mjs
- types.ts
- FeatureFrame.tsx
- circles.tsx
- actions.ts
- circles.mjschanged
- notification-events.mjs
- actionView.ts
Source anchors are injected deterministically. No GitHub repository is connected. File links are unavailable.
