Skip to content

Commit d672198

Browse files
committed
improvement(sim-links): use the shared resource table layout
1 parent c63e93e commit d672198

12 files changed

Lines changed: 328 additions & 177 deletions

File tree

‎apps/docs/content/docs/search/sim-links.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Short sim/ links that take everyone in your organization to the rig
55

66
Sim Links are short, memorable names for the pages your team opens often, like `sim/handbook` for the employee handbook or `sim/okta` for your sign-in portal. Anyone in the organization can open them, with or without a Search seat. They work like go links in other tools.
77

8-
Open **Sim Links** in the organization sidebar to see every link in your organization, with who created it, how often it's opened, and when it last changed. Search by name, destination, or description, and select **Most used** to see the 50 links your team opens most.
8+
Open **Sim Links** in the organization sidebar to see every link in your organization, with who created it, how often it's opened, and when it last changed. Search by name, destination, or description, and use **Sort → Opens** to see the 50 links your team opens most.
99

1010
## Open a link
1111

@@ -35,7 +35,7 @@ Chrome administrators can add this shortcut for everyone with the `SiteSearchSet
3535
4. Optionally add a **Description** so teammates know what the link is for.
3636
5. Select **Create**.
3737

38-
Select **Copy link** from a link's menu to share it.
38+
Right-click a link and select **Copy link** to share it.
3939

4040
## Add values to a link
4141

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
export { PAGE_COLUMN_CLASS } from '@/app/o/[organizationId]/components/organization-page/constants'
2-
export {
3-
OrganizationPage,
4-
type OrganizationPageTab,
5-
} from '@/app/o/[organizationId]/components/organization-page/organization-page'
2+
export { OrganizationPage } from '@/app/o/[organizationId]/components/organization-page/organization-page'
63
export { useOrganizationPageFilters } from '@/app/o/[organizationId]/components/organization-page/use-organization-page-filters'

‎apps/sim/app/o/[organizationId]/components/organization-page/organization-page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
SIDEBAR_DIVIDER_PAD_BELOW_CLASS,
2121
} from '@/app/workspace/[workspaceId]/w/components/sidebar/constants'
2222

23-
export interface OrganizationPageTab {
23+
interface OrganizationPageTab {
2424
id: string
2525
label: string
2626
}
Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
import { cn } from '@sim/emcn'
2-
import { HEADER_ACTION_CLUSTER, PAGE_HEADER_BAR } from '@/components/page-header-bar'
3-
import { PAGE_COLUMN_CLASS } from '@/app/o/[organizationId]/components/organization-page'
1+
'use client'
2+
3+
import { Link } from '@sim/emcn/icons'
4+
import { ResourceChromeFallback } from '@/app/workspace/[workspaceId]/components/resource/components/resource-chrome-fallback'
45

56
export default function SimLinksLoading() {
6-
return (
7-
<div className='flex h-full flex-col bg-[var(--bg)]'>
8-
<div className={PAGE_HEADER_BAR}>
9-
<div className={HEADER_ACTION_CLUSTER} />
10-
</div>
11-
<div className={cn(PAGE_COLUMN_CLASS, 'pt-8')}>
12-
<h1 className='text-[var(--text-primary)] text-lg'>Sim Links</h1>
13-
<p role='status' className='mt-4 text-[var(--text-muted)] text-small'>
14-
Loading Sim links
15-
</p>
16-
</div>
17-
</div>
18-
)
7+
return <ResourceChromeFallback icon={Link} title='Sim Links' />
198
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
import { createSerializer, parseAsString } from 'nuqs/server'
2+
import { SIM_LINK_SORTS } from '@/lib/sim-links/validation'
3+
import { createSortParams } from '@/lib/url-state'
24

35
/** `create` opens the new-link editor, prefilled with its value as the name. */
46
export const simLinkViewParsers = { create: parseAsString } as const
57

68
export const serializeSimLinkView = createSerializer(simLinkViewParsers)
9+
10+
/** `search` filters by name, destination, or description; only its URL write is debounced. */
11+
export const simLinksParsers = {
12+
...simLinkViewParsers,
13+
search: parseAsString.withDefault(''),
14+
} as const
15+
16+
/** Shared `sort` + `dir` params for the Sim Links list. Default: alphabetical. */
17+
export const simLinksSortParams = createSortParams(SIM_LINK_SORTS, {
18+
column: 'name',
19+
direction: 'asc',
20+
})
21+
22+
export const simLinksUrlKeys = { history: 'replace', clearOnDefault: true } as const
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
'use client'
2+
3+
import {
4+
DropdownMenu,
5+
DropdownMenuContent,
6+
DropdownMenuItem,
7+
DropdownMenuSeparator,
8+
DropdownMenuTrigger,
9+
} from '@sim/emcn'
10+
import { ArrowUpRight, Duplicate, Pencil, Trash } from '@sim/emcn/icons'
11+
12+
interface SimLinkContextMenuProps {
13+
isOpen: boolean
14+
position: { x: number; y: number }
15+
onClose: () => void
16+
onOpen: () => void
17+
onCopyLink: () => void
18+
/** Present only when the viewer may edit the link. */
19+
onEdit?: () => void
20+
/** Present only when the viewer may delete the link. */
21+
onDelete?: () => void
22+
}
23+
24+
/** Row actions for one Sim link, anchored where the row was right-clicked. */
25+
export function SimLinkContextMenu({
26+
isOpen,
27+
position,
28+
onClose,
29+
onOpen,
30+
onCopyLink,
31+
onEdit,
32+
onDelete,
33+
}: SimLinkContextMenuProps) {
34+
return (
35+
<DropdownMenu open={isOpen} onOpenChange={(open) => !open && onClose()} modal={false}>
36+
<DropdownMenuTrigger asChild>
37+
<div
38+
style={{
39+
position: 'fixed',
40+
left: `${position.x}px`,
41+
top: `${position.y}px`,
42+
width: '1px',
43+
height: '1px',
44+
pointerEvents: 'none',
45+
}}
46+
tabIndex={-1}
47+
aria-hidden
48+
/>
49+
</DropdownMenuTrigger>
50+
<DropdownMenuContent
51+
align='start'
52+
side='bottom'
53+
sideOffset={4}
54+
onCloseAutoFocus={(e) => e.preventDefault()}
55+
>
56+
<DropdownMenuItem onSelect={onOpen}>
57+
<ArrowUpRight />
58+
Open
59+
</DropdownMenuItem>
60+
{onEdit && (
61+
<DropdownMenuItem onSelect={onEdit}>
62+
<Pencil />
63+
Edit
64+
</DropdownMenuItem>
65+
)}
66+
<DropdownMenuItem onSelect={onCopyLink}>
67+
<Duplicate />
68+
Copy link
69+
</DropdownMenuItem>
70+
{onDelete && <DropdownMenuSeparator />}
71+
{onDelete && (
72+
<DropdownMenuItem onSelect={onDelete}>
73+
<Trash />
74+
Delete
75+
</DropdownMenuItem>
76+
)}
77+
</DropdownMenuContent>
78+
</DropdownMenu>
79+
)
80+
}

0 commit comments

Comments
 (0)