diff --git a/interface/ErrorFallback.tsx b/interface/ErrorFallback.tsx index a6be2fad9..4692d9a05 100644 --- a/interface/ErrorFallback.tsx +++ b/interface/ErrorFallback.tsx @@ -36,7 +36,7 @@ export function ErrorPage({
Error: {message}
{debug.enabled && (
-					Check the console (CMD/CRTL + OPTION + i) for stack trace.
+					Check the console (CMD/CTRL + OPTION + i) for stack trace.
 				
)}
diff --git a/interface/app/$libraryId/Explorer/File/ContextMenu.tsx b/interface/app/$libraryId/Explorer/File/ContextMenu.tsx index 330f423ee..f191038a8 100644 --- a/interface/app/$libraryId/Explorer/File/ContextMenu.tsx +++ b/interface/app/$libraryId/Explorer/File/ContextMenu.tsx @@ -18,7 +18,8 @@ import { isObject, useLibraryContext, useLibraryMutation, - useLibraryQuery + useLibraryQuery, + usePlausibleEvent } from '@sd/client'; import { ContextMenu, dialogManager } from '@sd/ui'; import { useExplorerParams } from '~/app/$libraryId/location/$id'; @@ -248,9 +249,16 @@ export default ({ data, ...props }: Props) => { }; const AssignTagMenuItems = (props: { objectId: number }) => { + const platform = usePlatform(); + const submitPlausibleEvent = usePlausibleEvent({ platformType: platform.platform }); + const tags = useLibraryQuery(['tags.list'], { suspense: true }); const tagsForObject = useLibraryQuery(['tags.getForObject', props.objectId], { suspense: true }); - const assignTag = useLibraryMutation('tags.assign'); + const assignTag = useLibraryMutation('tags.assign', { + onSuccess: () => { + submitPlausibleEvent({ event: { type: 'tagAssign' } }); + } + }); return ( <> diff --git a/interface/app/$libraryId/Layout/Sidebar/AddLocationButton.tsx b/interface/app/$libraryId/Layout/Sidebar/AddLocationButton.tsx index 27ed29c77..6c0e4ec68 100644 --- a/interface/app/$libraryId/Layout/Sidebar/AddLocationButton.tsx +++ b/interface/app/$libraryId/Layout/Sidebar/AddLocationButton.tsx @@ -1,12 +1,20 @@ -import { useLibraryMutation } from '@sd/client'; +import { useLibraryMutation, usePlausibleEvent } from '@sd/client'; import { dialogManager } from '@sd/ui'; import { usePlatform } from '~/util/Platform'; import AddLocationDialog from '../../settings/library/locations/AddDialog'; export default () => { const platform = usePlatform(); - - const createLocation = useLibraryMutation('locations.create'); + const submitPlausibleEvent = usePlausibleEvent({ platformType: platform.platform }); + const createLocation = useLibraryMutation('locations.create', { + onSuccess: () => { + submitPlausibleEvent({ + event: { + type: 'locationCreate' + } + }); + } + }); return (
+
+
+ +
+ Share anonymous usage + + + +
+ {/* TODO: Proper UI for this. Maybe checkbox for encrypted or not and then reveal these fields. Select encrypted by default. */} {/* Make the secret key field empty to skip key setup. */} diff --git a/interface/app/$libraryId/settings/node/libraries/DeleteDialog.tsx b/interface/app/$libraryId/settings/node/libraries/DeleteDialog.tsx index ae5454f1a..660424080 100644 --- a/interface/app/$libraryId/settings/node/libraries/DeleteDialog.tsx +++ b/interface/app/$libraryId/settings/node/libraries/DeleteDialog.tsx @@ -1,7 +1,8 @@ import { useQueryClient } from '@tanstack/react-query'; -import { useBridgeMutation } from '@sd/client'; +import { useBridgeMutation, usePlausibleEvent, useTelemetryState } from '@sd/client'; import { Dialog, UseDialogProps, useDialog } from '@sd/ui'; import { forms } from '@sd/ui'; +import { usePlatform } from '~/util/Platform'; const { useZodForm, z } = forms; @@ -11,11 +12,20 @@ interface Props extends UseDialogProps { export default function DeleteLibraryDialog(props: Props) { const dialog = useDialog(props); + const platform = usePlatform(); + const submitPlausibleEvent = usePlausibleEvent({ platformType: platform.platform }); + const shareTelemetry = useTelemetryState().shareTelemetry; const queryClient = useQueryClient(); const deleteLib = useBridgeMutation('library.delete', { onSuccess: () => { queryClient.invalidateQueries(['library.list']); + + submitPlausibleEvent({ + event: { + type: 'libraryDelete' + } + }); } }); diff --git a/interface/app/index.tsx b/interface/app/index.tsx index 3ab562b58..3c4d010f5 100644 --- a/interface/app/index.tsx +++ b/interface/app/index.tsx @@ -20,6 +20,11 @@ const Index = () => { return ; }; + +// NOTE: all route `Layout`s below should contain +// the `usePlausiblePageViewMonitor` hook, as early as possible (ideally within the layout itself). +// the hook should only be included if there's a valid `ClientContext` (so not onboarding) + const routes = [ { index: true, diff --git a/interface/app/onboarding/Layout.tsx b/interface/app/onboarding/Layout.tsx index 9b1d39fb3..b594218da 100644 --- a/interface/app/onboarding/Layout.tsx +++ b/interface/app/onboarding/Layout.tsx @@ -2,10 +2,11 @@ import BloomOne from '@sd/assets/images/bloom-one.png'; import clsx from 'clsx'; import { useEffect } from 'react'; import { Outlet, useNavigate } from 'react-router'; -import { getOnboardingStore } from '@sd/client'; +import { getOnboardingStore, useDebugState } from '@sd/client'; import { tw } from '@sd/ui'; import DragRegion from '~/components/DragRegion'; import { useOperatingSystem } from '~/hooks/useOperatingSystem'; +import DebugPopover from '../$libraryId/Layout/Sidebar/DebugPopover'; import Progress from './Progress'; export const OnboardingContainer = tw.div`flex flex-col items-center`; @@ -15,6 +16,7 @@ export const OnboardingImg = tw.img`w-20 h-20 mb-2`; export default () => { const os = useOperatingSystem(); + const debugState = useDebugState(); const navigate = useNavigate(); useEffect( @@ -39,7 +41,6 @@ export default () => { )} > -
@@ -55,6 +56,7 @@ export default () => { {/* */}
+ {debugState.enabled && } ); }; diff --git a/interface/app/onboarding/Progress.tsx b/interface/app/onboarding/Progress.tsx index 0d7a1be65..fbda0a396 100644 --- a/interface/app/onboarding/Progress.tsx +++ b/interface/app/onboarding/Progress.tsx @@ -24,7 +24,7 @@ export function useUnlockOnboardingScreen() { } export default function OnboardingProgress() { - const ob_store = useOnboardingStore(); + const obStore = useOnboardingStore(); const navigate = useNavigate(); const currentScreenKey = useCurrentOnboardingScreenKey(); @@ -37,7 +37,7 @@ export default function OnboardingProgress() { return (