diff --git a/apps/desktop/src/lib/trpc/routers/auto-update/index.ts b/apps/desktop/src/lib/trpc/routers/auto-update/index.ts index 8e15e0787..3515aa840 100644 --- a/apps/desktop/src/lib/trpc/routers/auto-update/index.ts +++ b/apps/desktop/src/lib/trpc/routers/auto-update/index.ts @@ -1,8 +1,10 @@ import { observable } from "@trpc/server/observable"; +import { app } from "electron"; import { type AutoUpdateStatusEvent, autoUpdateEmitter, checkForUpdates, + checkForUpdatesInteractive, dismissUpdate, getUpdateStatus, installUpdate, @@ -34,10 +36,18 @@ export const createAutoUpdateRouter = () => { return getUpdateStatus(); }), + getVersion: publicProcedure.query(() => { + return app.getVersion(); + }), + check: publicProcedure.mutation(() => { checkForUpdates(); }), + checkForUpdates: publicProcedure.mutation(() => { + checkForUpdatesInteractive(); + }), + install: publicProcedure.mutation(() => { installUpdate(); }), diff --git a/apps/desktop/src/renderer/screens/main/components/SettingsView/AccountSettings/AccountSettings.tsx b/apps/desktop/src/renderer/screens/main/components/SettingsView/AccountSettings/AccountSettings.tsx index 9f16c773f..d3db81331 100644 --- a/apps/desktop/src/renderer/screens/main/components/SettingsView/AccountSettings/AccountSettings.tsx +++ b/apps/desktop/src/renderer/screens/main/components/SettingsView/AccountSettings/AccountSettings.tsx @@ -2,15 +2,42 @@ import { Avatar, AvatarFallback, AvatarImage } from "@superset/ui/avatar"; import { Button } from "@superset/ui/button"; import { Skeleton } from "@superset/ui/skeleton"; import { toast } from "@superset/ui/sonner"; +import { HiOutlineClipboardDocument } from "react-icons/hi2"; import { trpc } from "renderer/lib/trpc"; +import { AUTO_UPDATE_STATUS } from "shared/auto-update"; +import { + isItemVisible, + SETTING_ITEM_ID, + type SettingItemId, +} from "../settings-search"; -export function AccountSettings() { +interface AccountSettingsProps { + visibleItems?: SettingItemId[] | null; +} + +export function AccountSettings({ visibleItems }: AccountSettingsProps) { + const showProfile = isItemVisible( + SETTING_ITEM_ID.ACCOUNT_PROFILE, + visibleItems, + ); + const showVersion = isItemVisible( + SETTING_ITEM_ID.ACCOUNT_VERSION, + visibleItems, + ); + const showSignOut = isItemVisible( + SETTING_ITEM_ID.ACCOUNT_SIGNOUT, + visibleItems, + ); const { data: user, isLoading } = trpc.user.me.useQuery(); + const { data: version } = trpc.autoUpdate.getVersion.useQuery(); + const { data: updateStatus } = trpc.autoUpdate.getStatus.useQuery(); + const checkForUpdatesMutation = trpc.autoUpdate.checkForUpdates.useMutation(); const signOutMutation = trpc.auth.signOut.useMutation({ onSuccess: () => toast.success("Signed out"), }); const signOut = () => signOutMutation.mutate(); + const isChecking = updateStatus?.status === AUTO_UPDATE_STATUS.CHECKING; const initials = user?.name ?.split(" ") @@ -20,7 +47,7 @@ export function AccountSettings() { .slice(0, 2); return ( -
@@ -30,46 +57,84 @@ export function AccountSettings() {
{user.name}
-{user.email}
-Unable to load user info
- )} + {showProfile && ( +{user.name}
++ {user.email} +
++ Unable to load user info +
+ )} +Version
+ ++ {isChecking ? "Checking..." : "Up to date"} +
+- Sign out of your Superset account on this device. -
- -- Rendering style for markdown files when viewing rendered content -
- -- Tufte style uses elegant serif typography inspired by Edward Tufte's - books -
-+ Rendering style for markdown files when viewing rendered content +
+ ++ Tufte style uses elegant serif typography inspired by Edward + Tufte's books +
+- Custom theme import coming soon. You'll be able to import JSON theme - files to create your own themes. -
-+ Custom theme import coming soon. You'll be able to import JSON + theme files to create your own themes. +
+- Show a confirmation dialog when quitting the app -
+ {showConfirmQuit && ( ++ Show a confirmation dialog when quitting the app +
+- Click the play button to preview a sound. Click stop or play another - to stop the current sound. -
-+ Click the play button to preview a sound. Click stop or play + another to stop the current sound. +
+