Skip to content

Conversation

Sahil2004
Copy link
Contributor

@Sahil2004 Sahil2004 commented Aug 7, 2025

Description of change

Ensures CI checks pass on the latest build

Issue Number

Closes #280

Type of change

  • Chore (refactoring, build scripts or anything else that isn't user-facing)

How the change has been tested

Manually.

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • New Features

    • Added new data types for chat and messaging in Pictique, enhancing chat and message handling capabilities.
  • Bug Fixes

    • Fixed post feed rendering in Pictique to display posts correctly.
    • Updated profile avatar fallback to use a local image when none is provided.
  • Refactor

    • Removed Paraglide localization and related demo pages from the control panel, simplifying configuration and UI.
    • Updated and reorganized code formatting, import statements, and type annotations across multiple files for improved readability and maintainability.
    • Improved CSS class ordering and fallback logic in several Pictique components for consistency.
  • Chores

    • Expanded the list of dependencies treated as "only built" in the main package configuration.
    • Changed Blabsy's formatting script to automatically fix code style issues instead of just checking them.
  • Style

    • Standardized quotation marks, indentation, and code style in various files without affecting functionality.
    • Reformatted JSX, Svelte, and TypeScript files for consistent code appearance.
  • Documentation

    • Updated configuration and ignore files to reflect removal of Paraglide-related paths.

@Sahil2004 Sahil2004 self-assigned this Aug 7, 2025
@Sahil2004 Sahil2004 requested a review from coodos as a code owner August 7, 2025 14:34
Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Walkthrough

This change set removes all references, configuration, and code related to "paraglide" from the control panel infrastructure. It deletes relevant source files, updates configuration files to eliminate paraglide-specific settings, and reverts language and localization logic to defaults. Minor related adjustments to HTML, CSS, and build scripts are also included.

Changes

Cohort / File(s) Change Summary
Remove Paraglide Source Files
infrastructure/control-panel/src/hooks.server.ts, infrastructure/control-panel/src/hooks.ts, infrastructure/control-panel/src/routes/demo/+page.svelte, infrastructure/control-panel/src/routes/demo/paraglide/+page.svelte
Deleted all source files implementing paraglide middleware, rerouting, demo pages, and localization logic.
Update Configurations to Remove Paraglide
infrastructure/control-panel/.gitignore, infrastructure/control-panel/biome.json, infrastructure/control-panel/vite.config.ts
Removed ignore rules, configuration sections, and build plugins related to paraglide.
Revert Language/Localization Handling
infrastructure/control-panel/src/app.html
Changed the HTML language attribute from a paraglide placeholder to a hardcoded "en" value.
CSS Scope Correction
infrastructure/control-panel/src/app.css
Replaced non-standard @theme with standard :root for CSS variables; removed extraneous brace.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant SvelteKitApp
    Note over SvelteKitApp: Previous flow (with paraglide)
    Browser->>SvelteKitApp: HTTP Request
    SvelteKitApp->>paraglideMiddleware: Process request for localization
    paraglideMiddleware->>SvelteKitApp: Modified event/request, locale
    SvelteKitApp->>Browser: Response with localized HTML

    Note over SvelteKitApp: New flow (after removal)
    Browser->>SvelteKitApp: HTTP Request
    SvelteKitApp->>Browser: Response with default HTML (lang="en")
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove all paraglide code, configuration, and references from control panel (#280)
Fix all checks within the scope of this PR (#280)

Suggested reviewers

  • sosweetham
  • coodos

Poem

A rabbit hopped through code so wide,
Sweeping out paraglide with pride.
No more plugins, hooks, or tricks—
Just clean control panel, swift and slick!
With every hop, the clutter’s gone,
The codebase fresh—let’s hop along! 🐇✨

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/paraglide

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa2b321 and b73f510.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • infrastructure/control-panel/.storybook/main.ts (1 hunks)
  • infrastructure/control-panel/.storybook/preview.ts (1 hunks)
  • infrastructure/control-panel/src/app.css (1 hunks)
  • infrastructure/control-panel/vite.config.ts (1 hunks)
  • platforms/blabsy/src/components/chat/chat-window.tsx (1 hunks)
  • platforms/blabsy/src/lib/hooks/useRequireAuth.ts (1 hunks)
  • platforms/pictique/src/lib/types.ts (1 hunks)
  • platforms/pictique/src/routes/(protected)/group/[id]/+page.svelte (10 hunks)
  • platforms/pictique/src/routes/(protected)/group/[id]/members/+page.svelte (3 hunks)
  • platforms/pictique/src/routes/(protected)/messages/+page.svelte (1 hunks)
✅ Files skipped from review due to trivial changes (7)
  • platforms/pictique/src/routes/(protected)/messages/+page.svelte
  • platforms/pictique/src/lib/types.ts
  • infrastructure/control-panel/.storybook/preview.ts
  • platforms/blabsy/src/lib/hooks/useRequireAuth.ts
  • platforms/pictique/src/routes/(protected)/group/[id]/members/+page.svelte
  • infrastructure/control-panel/.storybook/main.ts
  • platforms/pictique/src/routes/(protected)/group/[id]/+page.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
  • infrastructure/control-panel/vite.config.ts
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: in tailwind css v4, the traditional directive system has been removed. the `@tailwind base` directiv...
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/app.css:1-1
Timestamp: 2025-05-08T08:47:11.295Z
Learning: In Tailwind CSS v4, the traditional directive system has been removed. The `tailwind base` directive should be replaced with `import "tailwindcss/preflight";` for just base styles, or `import "tailwindcss";` to include all layers (preflight, components, and utilities).

Applied to files:

  • infrastructure/control-panel/src/app.css
📚 Learning: in tailwind css v4, the traditional `@tailwind base` directive is no longer available and should be ...
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/app.css:1-1
Timestamp: 2025-05-08T08:47:11.295Z
Learning: In Tailwind CSS v4, the traditional `tailwind base` directive is no longer available and should be replaced with `import "tailwindcss/preflight"` instead. The directive system has been changed in v4 to use direct imports.

Applied to files:

  • infrastructure/control-panel/src/app.css

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c63a5e and ac993ac.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/hooks.server.ts:2-2
Timestamp: 2025-05-08T08:50:11.515Z
Learning: For Paraglide v2.0.0, files must be generated by running the build process before importing from `$lib/paraglide/server`. Before generation, the direct import path is `inlang/paraglide-js/runtime/server`.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
platforms/pictique/src/lib/fragments/ActionMenu/ActionMenu.svelte (1)

56-58: Consider separating the statements for better readability.

The comma operator works but separating the statements into distinct lines would be clearer and more maintainable.

Apply this diff to improve readability:

 	onclick={(e) => {
-		e.preventDefault(), openMenu();
+		e.preventDefault();
+		openMenu();
 	}}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac993ac and 3810775.

📒 Files selected for processing (10)
  • platforms/blabsy/package.json (1 hunks)
  • platforms/blabsy/src/components/chat/add-members.tsx (15 hunks)
  • platforms/blabsy/src/components/chat/chat-list.tsx (1 hunks)
  • platforms/blabsy/src/components/chat/chat-window.tsx (7 hunks)
  • platforms/blabsy/src/components/chat/member-list.tsx (6 hunks)
  • platforms/blabsy/src/components/sidebar/mobile-sidebar.tsx (1 hunks)
  • platforms/blabsy/src/lib/context/auth-context.tsx (1 hunks)
  • platforms/pictique/src/declaration.d.ts (1 hunks)
  • platforms/pictique/src/lib/fragments/ActionMenu/ActionMenu.svelte (1 hunks)
  • platforms/pictique/src/lib/fragments/ChatMessage/ChatMessage.svelte (1 hunks)
✅ Files skipped from review due to trivial changes (7)
  • platforms/pictique/src/declaration.d.ts
  • platforms/blabsy/src/components/sidebar/mobile-sidebar.tsx
  • platforms/pictique/src/lib/fragments/ChatMessage/ChatMessage.svelte
  • platforms/blabsy/src/components/chat/chat-list.tsx
  • platforms/blabsy/src/lib/context/auth-context.tsx
  • platforms/blabsy/src/components/chat/add-members.tsx
  • platforms/blabsy/src/components/chat/member-list.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • platforms/blabsy/src/components/chat/chat-window.tsx
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/hooks.server.ts:2-2
Timestamp: 2025-05-08T08:50:11.515Z
Learning: For Paraglide v2.0.0, files must be generated by running the build process before importing from `$lib/paraglide/server`. Before generation, the direct import path is `inlang/paraglide-js/runtime/server`.
📚 Learning: 2025-05-08T08:40:51.710Z
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/lib/ui/Button/Button.svelte:83-83
Timestamp: 2025-05-08T08:40:51.710Z
Learning: In Svelte 5, event handlers should use lowercase DOM-style attributes (e.g., `onclick={handler}`) rather than the Svelte 3/4 syntax with the `on:` prefix (e.g., `on:click={handler}`). The `on:` syntax is deprecated in Svelte 5 though still supported for backward compatibility.

Applied to files:

  • platforms/pictique/src/lib/fragments/ActionMenu/ActionMenu.svelte
📚 Learning: 2025-05-08T08:40:51.710Z
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/lib/ui/Button/Button.svelte:83-83
Timestamp: 2025-05-08T08:40:51.710Z
Learning: In Svelte 5, event handlers can be written using the lowercase DOM-style attributes (e.g., `onclick`) rather than the Svelte 3/4 syntax with the `on:` prefix (e.g., `on:click`). Both syntaxes are supported, but `onclick` is the newer approach introduced in Svelte 5.

Applied to files:

  • platforms/pictique/src/lib/fragments/ActionMenu/ActionMenu.svelte
🔇 Additional comments (1)
platforms/blabsy/package.json (1)

11-12: Clarify intent of switching format from “check” to “write”

prettier --write mutates source files; it exits with a 0 status even when it edits content.
If your CI pipeline previously relied on npm run format failing when code was mis-formatted, this change will make the check ineffective and could let unformatted files merge.

Suggested follow-up:

     "start": "next start",
-    "format": "prettier --write .",
+    "format": "prettier --write .",
+    "format:check": "prettier --check .",

Then have CI call npm run format:check, while local contributors can still run npm run format for auto-fixes.

@sosweetham sosweetham changed the title chore: removed paraglide. fix: CI check passes Aug 8, 2025
@sosweetham sosweetham merged commit 4d89694 into main Aug 8, 2025
3 of 4 checks passed
@sosweetham sosweetham deleted the fix/paraglide branch August 8, 2025 07:51
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (2)
platforms/pictique-api/src/controllers/UserController.ts (2)

84-93: Bug: updateProfile can proceed when user is not found, passing undefined fields.

If findById returns null/undefined, the current code uses user?.… fallbacks, resulting in undefined values sent to updateProfile. Return 404 when the user does not exist, then build the payload from either incoming fields or the existing user.

Apply this diff:

   const user = await this.userService.findById(userId);
 
-  const updatedUser = await this.userService.updateProfile(userId, {
-      handle: handle ?? user?.handle,
-      avatarUrl: avatar ?? user?.avatarUrl,
-      name: name ?? user?.name,
-  });
+  if (!user) {
+      return res.status(404).json({ error: "User not found" });
+  }
+  const payload = {
+      handle: handle ?? user.handle,
+      avatarUrl: avatar ?? user.avatarUrl,
+      name: name ?? user.name,
+  };
+  const updatedUser = await this.userService.updateProfile(userId, payload);

11-13: Ensure safe serialization of req.user before responding

The Request interface is correctly augmented in platforms/pictique-api/src/types/express.d.ts to include user?: User. However, returning req.user directly will serialize all of its properties—including any sensitive or internal fields (e.g. email, tokens, roles). We should explicitly select only the public-facing fields or apply a serialization layer/DTO.

• File: platforms/pictique-api/src/controllers/UserController.ts
• Lines: 11–13

Suggestion:

-    res.json(req.user);
+    const user = req.user;
+    if (!user) {
+      return res.status(401).json({ error: 'Unauthorized' });
+    }
+    // Only expose public profile fields
+    const publicProfile = {
+      id: user.id,
+      handle: user.handle,
+      avatarUrl: user.avatarUrl,
+      name: user.name,
+    };
+    res.json(publicProfile);

– Verify any new fields added to User are intentionally exposed.
– If you have a central serializer/service, consider using that instead of inlining the mapping.

🧹 Nitpick comments (8)
platforms/pictique-api/src/controllers/UserController.ts (2)

53-73: Optional: strengthen follow invariants (self-follow and idempotency).

Consider blocking self-follow and making the operation idempotent (no-op if already following).

Example:

   const followerId = req.user?.id;
   const { id: followingId } = req.params;
 
   if (!followerId || !followingId) {
     return res.status(400).json({ error: "Missing required fields" });
   }
+  if (followerId === followingId) {
+    return res.status(400).json({ error: "Cannot follow yourself" });
+  }

16-33: Minor: centralize async error handling to reduce repetitive try/catch blocks.

You can wrap handlers with an asyncHandler to forward errors to Express’ error middleware, improving readability and consistency.

Example (outside this range):

// utils/asyncHandler.ts
export const asyncHandler =
  <P, ResBody, ReqBody, ReqQuery>(
    fn: (req: Request<P, ResBody, ReqBody, ReqQuery>, res: Response, next: NextFunction) => Promise<unknown>,
  ) =>
  (req: Request, res: Response, next: NextFunction) =>
    Promise.resolve(fn(req, res, next)).catch(next);

Then:

getProfileById = asyncHandler(async (req, res) => { ... });

Also applies to: 35-51, 53-73, 75-97

platforms/pictique/src/routes/(protected)/settings/+page.svelte (3)

39-41: Add status semantics and avoid layout shift for loading state

Reserve height and announce loading politely to AT.

-    <div class="flex h-12 items-center justify-center">
+    <div class="flex min-h-12 items-center justify-center" role="status" aria-live="polite">

43-45: Use alert semantics for error state (and mirror min height)

Ensures errors are announced assertively and height remains stable.

-    <div class="flex h-12 items-center justify-center">
+    <div class="flex min-h-12 items-center justify-center" role="alert" aria-live="assertive">

49-49: Standardize nullish fallback for avatar URL

The default asset /images/user.png exists under static/images/user.png. Across the codebase only two instances still use || '/images/user.png' (all others use ??):

• platforms/pictique/src/routes/(protected)/+layout.svelte (line 104)
• platforms/pictique/src/routes/(protected)/settings/+page.svelte (line 49)

Please confirm how your backend represents “no avatar” (null/undefined vs. empty/whitespace string) and then pick one:

Option A — only nullish fallback (preferred if the API never returns empty strings):

- profileSrc={profile?.avatarUrl || '/images/user.png'}
+ profileSrc={profile?.avatarUrl ?? '/images/user.png'}

Option B — treat blank/whitespace as missing too (if the API can return empty strings):

- profileSrc={profile?.avatarUrl || '/images/user.png'}
+ profileSrc={profile?.avatarUrl?.trim() ? profile.avatarUrl : '/images/user.png'}

(Optional) You might also centralize the default avatar URL in a shared constant to avoid drift.

platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte (1)

3-3: Remove unused Textarea import to keep CI/lint green

Textarea isn’t used in this file; drop it or use it.

-  import { Button, Input, Label, Textarea } from '$lib/ui';
+  import { Button, Input, Label } from '$lib/ui';
platforms/pictique/src/lib/types.ts (2)

84-101: Inconsistent naming & missing reuse in Chat

– Top-level uses avatar while nested participants use avatarUrl.
participants structure duplicated ad-hoc; consider extracting a Participant type for reuse across chat/message modules.
latestMessage omits a createdAt timestamp, which most timeline UIs require.

Tighten the model now before it propagates.


103-111: MessageType overlaps existing models

MessageType repeats avatar, handle, name, username already present in userProfile/Participant. Prefer composition over duplication to keep future changes bounded.

Example quick win:

-export type MessageType = {
-  id: string;
-  avatar: string;
-  handle: string;
-
-};
+export interface Message extends Pick<Participant, 'id' | 'avatarUrl' | 'handle' | 'name'> {
+  unread: boolean;
+  text: string;
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fe8d70 and 137980b.

📒 Files selected for processing (14)
  • infrastructure/control-panel/src/app.css (1 hunks)
  • package.json (1 hunks)
  • platforms/pictique-api/src/controllers/UserController.ts (1 hunks)
  • platforms/pictique/src/lib/fragments/SideBar/SideBar.svelte (1 hunks)
  • platforms/pictique/src/lib/icons/index.ts (1 hunks)
  • platforms/pictique/src/lib/stores/disclaimer.ts (1 hunks)
  • platforms/pictique/src/lib/stores/posts.ts (1 hunks)
  • platforms/pictique/src/lib/types.ts (2 hunks)
  • platforms/pictique/src/routes/(protected)/+layout.svelte (3 hunks)
  • platforms/pictique/src/routes/(protected)/home/+page.svelte (2 hunks)
  • platforms/pictique/src/routes/(protected)/messages/+page.svelte (4 hunks)
  • platforms/pictique/src/routes/(protected)/messages/[id]/+page.svelte (1 hunks)
  • platforms/pictique/src/routes/(protected)/settings/+page.svelte (1 hunks)
  • platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte (2 hunks)
✅ Files skipped from review due to trivial changes (6)
  • platforms/pictique/src/lib/icons/index.ts
  • infrastructure/control-panel/src/app.css
  • platforms/pictique/src/lib/stores/posts.ts
  • platforms/pictique/src/lib/stores/disclaimer.ts
  • platforms/pictique/src/lib/fragments/SideBar/SideBar.svelte
  • platforms/pictique/src/routes/(protected)/+layout.svelte
🚧 Files skipped from review as they are similar to previous changes (3)
  • package.json
  • platforms/pictique/src/routes/(protected)/messages/+page.svelte
  • platforms/pictique/src/routes/(protected)/home/+page.svelte
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/hooks.server.ts:2-2
Timestamp: 2025-05-08T08:50:11.515Z
Learning: For Paraglide v2.0.0, files must be generated by running the build process before importing from `$lib/paraglide/server`. Before generation, the direct import path is `inlang/paraglide-js/runtime/server`.
📚 Learning: 2025-05-08T09:02:43.311Z
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/stories/Button.svelte:0-0
Timestamp: 2025-05-08T09:02:43.311Z
Learning: The project uses Svelte 5, which uses the new "runes" API including $props() for handling component props instead of the export let syntax from Svelte 3/4.

Applied to files:

  • platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte
📚 Learning: 2025-05-08T09:02:43.311Z
Learnt from: pixel-punk-20
PR: MetaState-Prototype-Project/prototype#121
File: platforms/metagram/src/stories/Button.svelte:0-0
Timestamp: 2025-05-08T09:02:43.311Z
Learning: The project uses Svelte 5, which introduces the new "runes" API including $props() for handling component props instead of the export let syntax from Svelte 3/4.

Applied to files:

  • platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte
🔇 Additional comments (2)
platforms/pictique-api/src/controllers/UserController.ts (1)

1-1: Good change: type-only import for Express types.

Using import type avoids emitting a runtime import and aligns with isolated modules/ESM builds. No functional impact here.

platforms/pictique/src/routes/(protected)/messages/[id]/+page.svelte (1)

118-118: Styling reorder only – no functional impact

Re-ordering the Tailwind classes is harmless. ✅

Comment on lines 60 to 65
export type userProfile = {
userId: string;
username: string;
id: string;
handle: string;
name: string;
description: string;
avatarUrl: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Duplicate identity fields create ambiguity

userProfile now exposes both handle and username. Unless you have a clear “old vs. new” migration story, keeping both almost guarantees accidental misuse and brittle mapping code.

• Pick one canonical field (ideally handle) and deprecate/remove the other, or
• Mark the legacy one with a JSDoc @deprecated tag and schedule removal.

Also applies to: 70-70


🏁 Script executed:

#!/bin/bash
# Check the current state of userProfile type definition to see all fields
cat platforms/pictique/src/lib/types.ts | grep -A 20 "export type userProfile"

Length of output: 407


🏁 Script executed:

#!/usr/bin/env bash
# Search for .username usage across the codebase
rg "\.username\b" -n

# Search for .handle usage across the codebase
rg "\.handle\b" -n

Length of output: 7490


Deprecate legacy username in favor of handle

The userProfile type and UI code currently expose both username and handle, leading to ambiguity and the risk of inconsistent usage:

• platforms/pictique/src/lib/types.ts – userProfile defines both handle and username
• platforms/pictique/src/lib/fragments/Profile/Profile.svelte – uses profileData.username (alt/text) and profileData.handle (heading)
• platforms/pictique/src/lib/fragments/PostModal/PostModal.svelte – uses comment.author.handle
• platforms/pictique/src/routes/(protected)/profile/[id]/+page.svelte – references both profile?.username and profile?.handle
• platforms/pictique/src/routes/(protected)/messages/+page.svelte – renders message.username and message.handle in different contexts
• platforms/pictique/src/routes/(protected)/home/+page.svelte & +layout.svelte – intermix post.author.handle and legacy post.author.username

Please pick one canonical identity field (preferably handle), annotate the legacy field with a JSDoc @deprecated tag, and schedule its removal once all usages have been updated.

🤖 Prompt for AI Agents
In platforms/pictique/src/lib/types.ts around lines 60 to 65, the userProfile
type defines both handle and username, causing ambiguity. Mark the username
field with a JSDoc @deprecated annotation to indicate it is legacy and should
not be used. Keep handle as the canonical identity field. Plan to remove
username after updating all code references to use handle exclusively.

@@ -51,6 +51,7 @@
const { data } = await apiClient.get('/api/users');
handle = data.handle;
name = data.name;
profileImageDataUrl = data.avatarUrl;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Initialize avatar preview with a safe fallback and verify API contract

If data.avatarUrl can be null/empty, set a default to align with other pages. Also confirm PATCH uses expected field (avatar vs avatarUrl).

-    profileImageDataUrl = data.avatarUrl;
+    profileImageDataUrl = data?.avatarUrl || '/images/user.png';

Optional: only send avatar when changed to reduce payload/avoid unintended overwrites:

// Track initial value after onMount
let initialAvatar = $state('');
onMount(async () => {
  const { data } = await apiClient.get('/api/users');
  // ...
  profileImageDataUrl = data?.avatarUrl || '/images/user.png';
  initialAvatar = profileImageDataUrl;
});

// In saveProfileData()
const payload: Record<string, unknown> = { handle, name };
if (profileImageDataUrl !== initialAvatar) payload.avatar = profileImageDataUrl;
await apiClient.patch('/api/users/', payload);

🏁 Script executed:

#!/usr/bin/env bash
# 1) Check for any usage of Textarea to decide whether to keep/remove import.
rg -n "Textarea" -S || true
echo
# 2) Confirm default avatar asset existence and path pattern consistency.
fd -i -a 'user.png'
rg -n --fixed-strings "/images/user.png" || true
echo
# 3) Sanity-check API field naming consistency across codebase.
rg -n "\bavatarUrl\b" || true
rg -n "\bavatar\b" || true

Length of output: 25820


🏁 Script executed:

#!/usr/bin/env bash
# Inspect how the PATCH payload is constructed in the username settings page
rg -n -C3 "apiClient\.patch" 'platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte' || true

Length of output: 275


🏁 Script executed:

#!/usr/bin/env bash
# Check if Textarea component is used in the username settings page
rg -n "<Textarea" 'platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte' || echo "no usage"

Length of output: 129


Initialize avatar preview with safe default & remove unused Textarea import

  • In platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte:
    • Remove Textarea from the top‐level import (it isn’t used).
    • Change the on-mount avatar assignment from
      - profileImageDataUrl = data.avatarUrl;
      + profileImageDataUrl = data?.avatarUrl || '/images/user.png';
    • The PATCH payload already uses avatar (not avatarUrl), which matches the backend controller:
      await apiClient.patch('/api/users/', {
        handle,
      - avatar: profileImageDataUrl,
      + avatar: profileImageDataUrl,
        name
      });
  • Optional optimization: track the initial avatar URL and only include avatar in the payload if it has actually changed, to avoid redundant updates.
    let initialAvatar = '';
    onMount(async () => {
      const { data } = await apiClient.get('/api/users');
      profileImageDataUrl = data?.avatarUrl || '/images/user.png';
      initialAvatar = profileImageDataUrl;
    });
    
    async function saveProfileData() {
      const payload = { handle, name };
      if (profileImageDataUrl !== initialAvatar) {
        payload.avatar = profileImageDataUrl;
      }
      await apiClient.patch('/api/users/', payload);
    }
🤖 Prompt for AI Agents
In
platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte
at line 55, remove the unused Textarea import at the top of the file. Initialize
the avatar preview with a safe default by setting profileImageDataUrl to
data.avatarUrl or a fallback image like '/images/user.png' on mount. Track the
initial avatar URL in a variable (e.g., initialAvatar) and modify the
saveProfileData function to include the avatar field in the PATCH payload only
if the avatar has changed, avoiding redundant updates.

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.

Remove paraglide from control panel
3 participants