@@ -18,11 +18,18 @@ import {
1818 SIM_LINK_NAME_MAX_LENGTH ,
1919 SIM_LINK_VARIABLE ,
2020 simLinkFieldsSchema ,
21+ toSimLinkName ,
2122} from '@/lib/sim-links/validation'
2223import { useCreateSimLink , useUpdateSimLink } from '@/hooks/queries/sim-links'
2324
2425type Field = 'name' | 'url' | 'defaultUrl' | 'description'
2526
27+ const SIM_LINKS_DOCS_URL = 'https://docs.sim.ai/search/sim-links'
28+
29+ function openDocs ( ) {
30+ window . open ( SIM_LINKS_DOCS_URL , '_blank' , 'noopener,noreferrer' )
31+ }
32+
2633interface SimLinkModalProps {
2734 organizationId : string
2835 onClose : ( ) => void
@@ -101,11 +108,6 @@ export function SimLinkModal({ organizationId, onClose, link, initialName }: Sim
101108 value = { draft . url }
102109 onChange = { ( value ) => change ( 'url' , value ) }
103110 error = { errors . url }
104- hint = {
105- variable
106- ? `Variable link: sim/${ draft . name || 'name' } /value fills each ${ SIM_LINK_VARIABLE } .`
107- : `Add ${ SIM_LINK_VARIABLE } where a value typed after the name should go.`
108- }
109111 />
110112 { variable && (
111113 < ChipModalField
@@ -117,7 +119,7 @@ export function SimLinkModal({ organizationId, onClose, link, initialName }: Sim
117119 value = { draft . defaultUrl ?? '' }
118120 onChange = { ( value ) => change ( 'defaultUrl' , value || null ) }
119121 error = { errors . defaultUrl }
120- hint = { `Opens when sim/ ${ draft . name || 'name' } is used without a value .` }
122+ hint = { `Opens when no value fills ${ SIM_LINK_VARIABLE } .` }
121123 />
122124 ) }
123125 < ChipModalField
@@ -128,9 +130,8 @@ export function SimLinkModal({ organizationId, onClose, link, initialName }: Sim
128130 placeholder = 'handbook'
129131 maxLength = { SIM_LINK_NAME_MAX_LENGTH }
130132 value = { draft . name }
131- onChange = { ( value ) => change ( 'name' , value ) }
133+ onChange = { ( value ) => change ( 'name' , toSimLinkName ( value ) ) }
132134 error = { errors . name ?? ( nameTaken ? mutation . error ?. message : undefined ) }
133- hint = 'Letters, numbers, and . : @ & ~ - _. Case and punctuation are ignored, so sim/Q4-goals is sim/q4goals.'
134135 />
135136 < ChipModalField
136137 type = 'input'
@@ -146,9 +147,7 @@ export function SimLinkModal({ organizationId, onClose, link, initialName }: Sim
146147 type = 'custom'
147148 title = 'Access'
148149 hint = {
149- canManage
150- ? 'Anyone in your organization can open this link.'
151- : 'Only the creator or an organization admin can change access.'
150+ canManage ? undefined : 'Only the creator or an organization admin can change access.'
152151 }
153152 >
154153 { ( aria ) => (
@@ -162,7 +161,7 @@ export function SimLinkModal({ organizationId, onClose, link, initialName }: Sim
162161 onCheckedChange = { ( checked ) => change ( 'unlisted' , checked === true ) }
163162 />
164163 < span className = 'text-[var(--text-primary)] text-small' >
165- Hide from the Sim Links page for everyone except you and admins
164+ Hide from the Sim Links page
166165 </ span >
167166 </ label >
168167 < label htmlFor = { restrictEditId } className = 'flex cursor-pointer items-center gap-2' >
@@ -174,7 +173,7 @@ export function SimLinkModal({ organizationId, onClose, link, initialName }: Sim
174173 onCheckedChange = { ( checked ) => change ( 'restrictEdit' , checked === true ) }
175174 />
176175 < span className = 'text-[var(--text-primary)] text-small' >
177- Restrict editing to you and admins
176+ Only you and admins can edit
178177 </ span >
179178 </ label >
180179 </ div >
@@ -184,6 +183,7 @@ export function SimLinkModal({ organizationId, onClose, link, initialName }: Sim
184183 </ ChipModalBody >
185184 < ChipModalFooter
186185 onCancel = { onClose }
186+ secondaryActions = { [ { label : 'Learn more' , onClick : openDocs } ] }
187187 primaryAction = { {
188188 label : mutation . isPending ? pendingLabel : actionLabel ,
189189 disabled : mutation . isPending ,
0 commit comments