Everything's pretty much done but url.zoo.dev has been broken and we need to think about how to test reliably

This commit is contained in:
49lf
2024-10-19 00:12:58 -04:00
parent 2193d563c5
commit c29be6e341
4 changed files with 53 additions and 22 deletions

View File

@ -99,7 +99,7 @@ function ProjectMenuPopover({
const location = useLocation()
const navigate = useNavigate()
const filePath = useAbsoluteFilePath()
const { settings } = useSettingsAuthContext()
const { settings, auth } = useSettingsAuthContext()
const { commandBarState, commandBarSend } = useCommandsContext()
const { onProjectClose } = useLspContext()
const exportCommandInfo = { name: 'Export', groupId: 'modeling' }
@ -188,12 +188,14 @@ function ProjectMenuPopover({
Element: 'button',
children: 'Share link to file',
onClick: async () => {
const shareUrl = createFileLink({
const shareUrl = await createFileLink(auth.context.token, {
code: codeManager.code,
name: file?.name || '',
units: settings.context.modeling.defaultUnit.current,
})
console.log(shareUrl)
await globalThis.navigator.clipboard.writeText(shareUrl)
toast.success(
'Link copied to clipboard. Anyone who clicks this link will get a copy of this file. Share carefully!',