# מראה ופרופילים

> תיעוד מקור. מקור: docs/appearance-and-profiles.md · 6a466bf.
> בגרסה הציבורית הושמטו מזהים תפעוליים ופרטי חשבון אישיים. קובץ המקור נשמר במאגר.

Release date: 2026-11-08. Product: <https://product.linknodesenergy.com>.

## Appearance

The driver application, business portal, onboarding and Clerk screens share light, dark and device-based modes. The header offers a quick toggle; `/settings`, `/account` and workspace settings offer all three choices. The preference is local to the browser (`lne:appearance`), synchronizes across tabs and follows device changes only in automatic mode. A prepaint script prevents a light background before hydration. Blocked browser storage has an in-memory fallback.

Dark colors use semantic tokens in `styles/appearance.css`. Surface, border, text, status and chart colors adapt without changing the light palette. The national map switches its basemap while retaining station layers, filters and selection. Provider logos retain their original brand backgrounds. Website and admin surfaces are outside this release.

## Personal identity

`/account` renders the real Clerk UserProfile for signed-in users: profile photo, first and last name, verified email management, password/security and active sessions. The header account menu navigates there. Guests receive a sign-in link. Identity data remains managed by Clerk, separate from tenant data and permissions.

Production email/password sign-in remains enabled with the existing password and device-security policies. Optional first and last name fields are enabled. The product uses Clerk's prebuilt sign-in/sign-up forms and will display social providers when they are configured successfully.

### Google and Apple activation remains pending

The owner confirmed that Google Cloud and Apple Developer accounts do not yet exist. Neither provider is advertised as active, and no placeholder social sign-in flow is implemented.

1. Create the company-owned Google Cloud project, configure its OAuth consent screen, then create web OAuth credentials. In the **production LinkNodes Energy Clerk instance**, add Google and copy the exact authorized redirect URI shown by Clerk to Google Cloud. Enter credentials directly in Clerk, configure the production audience and publish the consent configuration as required.
2. Enroll the company in Apple Developer, configure Sign in with Apple, the web Services ID, domains/return URL and signing credentials using the exact values shown by the **production Clerk instance**. Enter those credentials directly in Clerk.
3. Validate each provider with a real account, including email/identity linking and sign-out. Confirm Apple key/secret renewal responsibilities. Only then treat either provider as released.

Do not paste OAuth secrets in tickets, repository files, browser bundles or chat. No new Supabase authentication provider is needed: Clerk continues issuing the JWT trusted by the existing Supabase third-party integration.

## Organization and personal workspace profiles

Workspace settings (`/platform/<tenant-id>/settings`) read and persist the display name, legal name, company/tax number, industry, contact name/email/phone, HTTPS website, street, city, postal code and country. Personal workspaces omit business identity fields. A contact email does not grant membership or change a user's verified login email.

Active members may view their workspace profile. Only owners and admins may edit details or upload/remove the workspace image. Ownership, membership, commercial terms and finance fields are excluded from these APIs. Revision checks return HTTP 409 for stale writes; name/legal identity and profile revision are read in one PostgREST snapshot.

PNG, JPEG and WebP uploads accept at most 2 MB and 16 million decoded pixels. The server validates the actual image, rejects animation/SVG, strips metadata and normalizes to WebP up to 512 pixels. Immutable randomized paths belong to the tenant. The private `workspace-logos` bucket checks membership and edit permissions with RLS. Images are served through an authenticated same-origin endpoint with `private, no-store`; there are no permanent public or reusable signed image URLs. Removing membership immediately prevents subsequent image requests. Failed saves retain the prior image; superseded unreferenced files are removed on a best-effort basis.

The additive `20261108013050_workspace_profiles.sql` migration adds one table (14 columns), two audited RPC operations and the private image bucket/policies. The data inventory is now 31 tables and 256 columns. Tenant scope is immutable and direct browser writes to the profile table are denied. Demo profiles/images persist only in browser storage and are labeled accordingly.

## Verification before release

- TypeScript, ESLint and optimized Next.js build.
- 120 unit tests, including strict profile input validation and image normalization/bounds.
- 17 profile/database isolation checks, 14 provider isolation checks and 28 existing tenant isolation checks on the isolated local PostgreSQL database; fixtures rolled back.
- 10 browser scenarios covering appearance persistence, device/cross-tab changes, blocked storage, demo profile and image changes, desktop/390/320 px layouts, a loaded national map switching themes, and existing provider preferences.
- Live Supabase migration applied. Security advisory scan returned only the six existing informational private-table entries.

## Production release evidence

Final production deployment: `[operational-id-redacted]` (READY), runtime source `0dd50949e1353ddde5009c3aef7185be2393e181`. Public alias: <https://product.linknodesenergy.com>. The initial functional release was `[operational-id-redacted]`; the final patches improve the narrow mobile identity layout, Clerk badge contrast and embedded sign-in/sign-up form widths.

Thirteen authenticated live checks passed using a disposable Clerk identity: guest rejection, real sign-in, initial profile read, UI save/reload, stale revision rejection, normalized private logo upload/delivery, image reload, anonymous image rejection, removal, embedded Clerk UserProfile, persisted personal photo/name, mobile fit and no browser page errors. The release verification helper requires explicitly supplied private configuration and disposable identity paths. Existing customer identities and workspaces were not modified.

All five appearance/profile browser scenarios also passed against the public domain, including the loaded national map and its 503-location ON-EV filter surviving a theme switch. Additional visual inspection of a signed-in account at 390 and 320 pixels caught and corrected a crowded identity card. Email/password production configuration is enabled; Google and Apple are confirmed disabled pending company-owned credentials. The anonymous login and registration screens render actual Clerk forms; both were verified to fit a 320-pixel viewport on the final deployment.

The disposable workspace and its private images were removed; SQL confirmed zero remaining workspace/image records and the tenant audit trigger enabled. Temporary verification identities are deleted and sessions revoked after inspection. Credentials and sign-in tickets are never included in the repository or release output.

Real OAuth, charging-network commands, payments and accounting integrations are not activated by this change.
