Skip to content

Commit 063f7fb

Browse files
committed
improvement(platform): give zone and organization views one shared helper layer
1 parent 5245be8 commit 063f7fb

98 files changed

Lines changed: 151 additions & 141 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/sim/platform/AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Gates live on the server and arrive as data. Hiding an entry is navigation, not
7676

7777
`embedded/` holds the organization views and their data (`embedded/app`, `embedded/lib`). It is not a Next app and has no pages: the main app's `app/o/[organizationId]/` routes mount it, for every organization, whatever the `platform-org-ui` flag says. An edit here ships in the main app's build. It is built on the host, not on this project: it imports the host's hooks, stores, providers and packages, legacy chrome included (`WorkspaceChrome`, the legacy composer, Search's source cards), and the data seam and seam closure do not apply to it. `check:boundaries` sets its own seam: views read data through `embedded/lib/data`, and that layer points away from views and routes.
7878

79-
The zone and `embedded/` share only `design-system/`. Neither imports the other, not even for a type (`check:platform-design` rule `zone-embedded`, `check:boundaries` rule 7), so a change to a view here does not change the zone, and a similar view in each is two views. `app/o` is the only legacy code that may import `@/platform/*`, and only those two trees; `check:platform-css` holds every other entry out, and `check:platform-design` holds `app/o` out of the zone.
79+
The zone and `embedded/` share only `design-system/` and `shared/`, which holds pure helpers and imports neither of them. Neither imports the other, not even for a type (`check:platform-design` rule `zone-embedded`, `check:boundaries` rule 7), so a change to a view here does not change the zone, and a similar view in each is two views. `app/o` is the only legacy code that may import `@/platform/*`, and only those two trees; `check:platform-css` holds every other entry out, and `check:platform-design` holds `app/o` out of the zone.
8080

8181
Org context comes from a different place in each. A view here calls `useOrganization()` from `@/lib/organizations/provider`, which the `app/o` layout fills from `getOrganizationSurfaceContext`. The zone calls its own from `@/platform/lib/data/organization`. `surfaceHref`, `legacyRoutes` and `routePrefix` are the zone's and do not exist here: a link here is a host route (`@/lib/navigation/paths`). Each tree has its own `usePlatformNotices`. `PlatformSurface` collapses inside another, so a part can wrap itself when it alternates with legacy chrome.
8282

‎apps/sim/platform/app/(shell)/_components/chat/message/message-time.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { formatClockTime } from '@/platform/lib/time'
1+
import { formatClockTime } from '@/platform/shared/time'
22

33
interface MessageTimeProps {
44
sentAt: number

‎apps/sim/platform/app/(shell)/_components/chat/panel/panel-content.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
WorkspaceList,
1414
} from '@/platform/design-system/components'
1515
import { useCompactViewport } from '@/platform/design-system/components/layout/use-compact-viewport'
16-
import { formatRelativeTime } from '@/platform/lib/time'
16+
import { formatRelativeTime } from '@/platform/shared/time'
1717

1818
interface PanelContentProps {
1919
view: PanelDestination

‎apps/sim/platform/app/(shell)/_components/links-page/links-page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
import type { MenuAction } from '@/platform/design-system/components/menu/action-menu'
2424
import type { LoadMoreState } from '@/platform/design-system/components/scroll-area/use-load-more'
2525
import { type LinkRecord, linkFaviconSrc, openLink, useLinksPage } from '@/platform/lib/data/links'
26-
import { formatRelativeTime } from '@/platform/lib/time'
26+
import { formatRelativeTime } from '@/platform/shared/time'
2727

2828
const COLUMNS = [
2929
{ key: 'name', label: 'Name', kind: 'text' },

‎apps/sim/platform/app/(shell)/_components/organization-menu/organization-menu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '@/platform/design-system/components'
1616
import { IdentityButton } from '@/platform/design-system/components/identity-button/identity-button'
1717
import { AnchoredPopover } from '@/platform/design-system/components/menu/anchored-popover'
18-
import { plural } from '@/platform/lib/plural'
18+
import { plural } from '@/platform/shared/plural'
1919

2020
/** Lazy because its form reads real data, which a fixture session never loads. */
2121
const InviteModal = dynamic(

‎apps/sim/platform/app/(shell)/_components/settings-navigation/settings-navigation.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { SettingsNavGroup } from '@/platform/app/(shell)/_components/model'
66
import styles from '@/platform/app/(shell)/_components/settings-navigation/settings-navigation.module.css'
77
import { Chip, SearchField } from '@/platform/design-system/components'
88
import { platformHref } from '@/platform/design-system/navigation'
9-
import { plural } from '@/platform/lib/plural'
9+
import { plural } from '@/platform/shared/plural'
1010

1111
interface SettingsNavigationProps {
1212
section?: string

‎apps/sim/platform/app/(shell)/home/_components/activity-chart/activity-chart.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ChartTooltip } from '@/platform/design-system/components/chart/chart-to
1515
import { usePlotInspection } from '@/platform/design-system/components/chart/use-plot-inspection'
1616
import { RangePicker } from '@/platform/design-system/components/menu/range-picker'
1717
import { useScrollEdges } from '@/platform/design-system/components/scroll-area/use-scroll-edges'
18-
import { DAY_MS, formatCalendarDate } from '@/platform/lib/time'
18+
import { DAY_MS, formatCalendarDate } from '@/platform/shared/time'
1919

2020
interface HomeActivityChartProps {
2121
title: string

‎apps/sim/platform/app/(shell)/home/_components/activity-list/activity-list.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
ScrollArea,
1818
} from '@/platform/design-system/components'
1919
import { platformHref } from '@/platform/design-system/navigation'
20-
import { formatRelativeTime } from '@/platform/lib/time'
20+
import { formatRelativeTime } from '@/platform/shared/time'
2121

2222
interface EmailListProps {
2323
items: readonly EmailItem[]

‎apps/sim/platform/app/(shell)/home/_components/calendar/calendar-day.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
OverflowText,
1717
} from '@/platform/design-system/components'
1818
import { useScrollEdges } from '@/platform/design-system/components/scroll-area/use-scroll-edges'
19-
import { formatCalendarDate, formatClockTime, formatTimeRange } from '@/platform/lib/time'
19+
import { formatCalendarDate, formatClockTime, formatTimeRange } from '@/platform/shared/time'
2020

2121
interface CalendarDayProps {
2222
calendar: HomeCalendarDay

‎apps/sim/platform/app/(shell)/people/_components/import/import-modal.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
useProvisioningConnection,
2727
} from '@/platform/lib/data/people'
2828
import { toast } from '@/platform/lib/data/toast'
29-
import { plural } from '@/platform/lib/plural'
29+
import { plural } from '@/platform/shared/plural'
3030

3131
const ACCEPTED_FILES = '.csv,.tsv,.xlsx,.xls'
3232

0 commit comments

Comments
 (0)