Skip to content

Conversation

@Inglan
Copy link
Member

@Inglan Inglan commented Sep 23, 2025

Summary by CodeRabbit

  • New Features

    • Added dedicated Account page with full-profile management.
    • Backups list now shows creation time and IDs, and loads full history.
    • Introduced user data sync endpoints and client save capability for settings, favourites, and history.
  • Style

    • Auth UI now adapts to dark mode.
    • Sidebar tweaks: truncated repository label, restyled branch indicator, account menu links to /account.
  • Chores

    • Build workflow updated to use official Node/pnpm setup action, removing custom container and manual installs.

@Inglan Inglan enabled auto-merge September 23, 2025 02:49
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Removes Arch Linux container and pacman installs from CI, switching to pnpm/action-setup. Backend adds JWT verification/utilities, a users table, and sync endpoints; updates backups to use user ids. Frontend adds sync helpers/state, adjusts UI components, themes Clerk, and adds an /account page rendering UserProfile.

Changes

Cohort / File(s) Summary of changes
CI Workflow
.github/workflows/build.yml
Drops container image and pacman installs; uses pnpm/action-setup@v4 (pnpm v9); retains checkout/install/build steps.
Convex auth, users, backups, and sync
src/convex/backups.ts, src/convex/sync.ts, src/convex/utils.ts
Centralizes JWT verification and user resolution via new utils; backups now use userInfo._id and return richer data; adds sync query/mutation for user settings/favourites/history.
Convex schema and types
src/convex/schema.ts, src/convex/types.ts
Adds users table with index on clerkId; changes comments.user and backup.user to v.id('users'); introduces JWTPayload interface.
Frontend components (UI adjustments)
src/lib/components/app-sidebar.svelte, src/lib/components/providers.svelte, src/lib/components/settings.svelte, src/lib/components/sidebar-auth.svelte
Sidebar label/branch rendering tweaks; ClerkProvider gains appearance with dark theme; settings component adds Clerk/Convex integration, token retrieval, and change handler; sidebar auth links to /account and includes commented sync/settings UI.
Frontend sync state and helpers
src/lib/state.svelte.ts, src/lib/stores.ts, src/lib/sync.ts
Adds syncState and syncSettingsStore; introduces save(jwt, client, options) to upload selected data to Convex api.sync.update.
Account route
src/routes/account/[...slug]/+page.svelte
New route rendering UserProfile at /account with custom full-bleed appearance.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Frontend UI
  participant Sync as sync.save (client)
  participant API as Convex api.sync.update
  participant Utils as utils (verifyJwt,getUser,getAndUpdateUser)
  participant DB as DB (users)

  UI->>Sync: save(jwt, client, {settings|history|favourites})
  Sync->>API: update({ jwt, settings?, history?, favourites? })
  API->>Utils: verifyJwtAndGetPayload(jwt)
  Utils-->>API: payload (sub)
  API->>Utils: getAndUpdateUser(ctx, payload)
  Utils->>DB: find/patch/insert by clerkId
  DB-->>Utils: user (_id)
  Utils-->>API: userInfo (_id)
  API->>DB: patch users[_id] with provided fields
  DB-->>API: ok
  API-->>Sync: ok
  Sync-->>UI: clear syncState
  note over API,DB: Errors if jwt invalid or user missing
Loading
sequenceDiagram
  autonumber
  participant Client as Frontend
  participant BGet as convex.backups.get
  participant BCreate as convex.backups.create
  participant BRemove as convex.backups.remove
  participant Utils as utils (verifyJwt, getUser/getAndUpdateUser)
  participant DB as DB (backups, users)

  rect rgb(235,245,255)
  note right of Client: Get backups
  Client->>BGet: { jwt }
  BGet->>Utils: verifyJwtAndGetPayload
  BGet->>Utils: getUser(ctx, payload)
  Utils-->>BGet: userInfo or null
  alt user not found
    BGet-->>Client: []
  else user found
    BGet->>DB: query backups by userId
    DB-->>BGet: list (name,data,creationTime,id)
    BGet-->>Client: results
  end
  end

  rect rgb(245,235,255)
  note right of Client: Create backup
  Client->>BCreate: { jwt, name, data }
  BCreate->>Utils: verifyJwtAndGetPayload
  BCreate->>Utils: getAndUpdateUser
  Utils-->>BCreate: userInfo (_id)
  BCreate->>DB: insert { user: _id, name, data }
  DB-->>BCreate: ok
  BCreate-->>Client: ok
  end

  rect rgb(235,255,245)
  note right of Client: Remove backup
  Client->>BRemove: { jwt, id }
  BRemove->>Utils: verifyJwtAndGetPayload
  BRemove->>DB: get backup[id]
  DB-->>BRemove: backup
  BRemove->>Utils: getAndUpdateUser
  Utils-->>BRemove: userInfo (_id)
  alt authorized (backup.user == _id)
    BRemove->>DB: delete id
    DB-->>BRemove: ok
    BRemove-->>Client: ok
  else unauthorized
    BRemove-->>Client: Unauthorized
  end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • nathblade16
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch main

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f78233 and 829fd21.

⛔ Files ignored due to path filters (1)
  • src/convex/_generated/api.d.ts is excluded by !**/_generated/**
📒 Files selected for processing (14)
  • .github/workflows/build.yml (1 hunks)
  • src/convex/backups.ts (3 hunks)
  • src/convex/schema.ts (1 hunks)
  • src/convex/sync.ts (1 hunks)
  • src/convex/types.ts (1 hunks)
  • src/convex/utils.ts (1 hunks)
  • src/lib/components/app-sidebar.svelte (1 hunks)
  • src/lib/components/providers.svelte (2 hunks)
  • src/lib/components/settings.svelte (4 hunks)
  • src/lib/components/sidebar-auth.svelte (3 hunks)
  • src/lib/state.svelte.ts (1 hunks)
  • src/lib/stores.ts (1 hunks)
  • src/lib/sync.ts (1 hunks)
  • src/routes/account/[...slug]/+page.svelte (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

Deploying edutools-testing with  Cloudflare Pages  Cloudflare Pages

Latest commit: 545b726
Status: ✅  Deploy successful!
Preview URL: https://6ab843a4.edutools-testing.pages.dev
Branch Preview URL: https://main.edutools-testing.pages.dev

View logs

@Inglan Inglan merged commit e661d83 into prod Sep 23, 2025
4 of 5 checks passed
This was referenced Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants