Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { DesktopErrorBoundary } from "@/components/errors/ErrorBoundaries";
import { useAutoCloudSync } from "@/hooks/useAutoCloudSync";
import { AirDropListener } from "@/components/AirDropListener";
import { useFilesStore } from "@/stores/useFilesStore";
import { isWindowsTheme } from "@/themes";

// Convert registry to array
const apps: AnyApp[] = Object.values(appRegistry);
Expand All @@ -44,9 +45,9 @@ export function App() {

// Determine toast position and offset based on theme and device
const toastConfig = useMemo(() => {
const isWindowsTheme = currentTheme === "xp" || currentTheme === "win98";
const windowsTheme = isWindowsTheme(currentTheme);
const dockHeight = currentTheme === "macosx" ? 56 : 0;
const taskbarHeight = isWindowsTheme ? 30 : 0;
const taskbarHeight = windowsTheme ? 30 : 0;

// Mobile: always show at bottom-center with dock/taskbar and safe area clearance
if (isMobile) {
Expand All @@ -57,7 +58,7 @@ export function App() {
};
}

if (isWindowsTheme) {
if (windowsTheme) {
// Windows themes: bottom-right with taskbar clearance (30px + padding)
return {
position: "bottom-right" as const,
Expand Down
3 changes: 2 additions & 1 deletion src/apps/admin/components/AdminMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from "@/components/ui/menubar";
import { useThemeStore } from "@/stores/useThemeStore";
import { useTranslation } from "react-i18next";
import { isWindowsTheme } from "@/themes";

type AdminSection = "dashboard" | "users" | "rooms" | "songs" | "server";

Expand All @@ -35,7 +36,7 @@ export function AdminMenuBar({
}: AdminMenuBarProps) {
const { t } = useTranslation();
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOsxTheme = currentTheme === "macosx";

return (
Expand Down
3 changes: 2 additions & 1 deletion src/apps/admin/hooks/useAdminLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
type AdminSection,
} from "../utils/navigationState";
import { helpItems } from "..";
import { isWindowsTheme } from "@/themes";

/**
* Format Kugou image URL with size and HTTPS
Expand Down Expand Up @@ -173,7 +174,7 @@ export function useAdminLogic({ isWindowOpen }: UseAdminLogicProps) {
const { username, isAuthenticated } = useAuth();
const isOffline = useOffline();
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);

const [isHelpDialogOpen, setIsHelpDialogOpen] = useState(false);
const [isAboutDialogOpen, setIsAboutDialogOpen] = useState(false);
Expand Down
3 changes: 2 additions & 1 deletion src/apps/applet-viewer/components/AppStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AppStoreFeed, type AppStoreFeedRef } from "./AppStoreFeed";
import { useTranslation } from "react-i18next";
import { getApiUrl } from "@/utils/platform";
import { abortableFetch } from "@/utils/abortableFetch";
import { isWindowsTheme } from "@/themes";

interface AppStoreProps {
theme?: string;
Expand All @@ -34,7 +35,7 @@ export function AppStore({ theme, sharedAppletId, focusWindow }: AppStoreProps)
const isMacTheme = theme === "macosx";
const isSystem7Theme = theme === "system7";
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);

const actions = useAppletActions();
const lastUpdateToastKeyRef = useRef<string | null>(null);
Expand Down
3 changes: 2 additions & 1 deletion src/apps/applet-viewer/components/AppStoreFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useTranslation } from "react-i18next";
import { getApiUrl } from "@/utils/platform";
import { useChatsStoreShallow } from "@/stores/helpers";
import { abortableFetch } from "@/utils/abortableFetch";
import { isWindowsTheme } from "@/themes";

interface AppStoreFeedProps {
theme?: string;
Expand Down Expand Up @@ -54,7 +55,7 @@ export const AppStoreFeed = forwardRef<AppStoreFeedRef, AppStoreFeedProps>(
const PREVIEW_Y_SPACING = -28;
const isMacTheme = theme === "macosx" || currentTheme === "macosx";
const isSystem7Theme = theme === "system7" || currentTheme === "system7";
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);

const actions = useAppletActions();

Expand Down
3 changes: 2 additions & 1 deletion src/apps/applet-viewer/components/AppletViewerMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useChatsStore } from "@/stores/useChatsStore";
import { ShareItemDialog } from "@/components/dialogs/ShareItemDialog";
import { appRegistry } from "@/config/appRegistry";
import { useTranslation } from "react-i18next";
import { isWindowsTheme } from "@/themes";

interface AppletViewerMenuBarProps {
onClose: () => void;
Expand Down Expand Up @@ -61,7 +62,7 @@ export function AppletViewerMenuBar({
const appId = "applet-viewer";
const appName = appRegistry[appId as keyof typeof appRegistry]?.name || appId;
const currentTheme = useThemeStore((s) => s.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOsxTheme = currentTheme === "macosx";
const launchApp = useLaunchApp();
const fileInputRef = React.useRef<HTMLInputElement>(null);
Expand Down
3 changes: 2 additions & 1 deletion src/apps/applet-viewer/hooks/useAppletViewerLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { track } from "@vercel/analytics";
import { APPLET_ANALYTICS } from "@/utils/analytics";
import { extractMetadataFromHtml } from "@/utils/appletMetadata";
import { exportAppletAsHtml } from "@/utils/appletImportExport";
import { isWindowsTheme } from "@/themes";
import {
emitFileSaved,
onAppletUpdated,
Expand All @@ -54,7 +55,7 @@ export function useAppletViewerLogic({
const iframeRef = useRef<HTMLIFrameElement>(null);
const fileInputRef = useRef<HTMLInputElement>(null);
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacTheme = currentTheme === "macosx";
const username = useChatsStore((state) => state.username);
const isAuthenticated = useChatsStore((state) => state.isAuthenticated);
Expand Down
3 changes: 2 additions & 1 deletion src/apps/base/AppManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
toggleSpotlightSearch,
} from "@/utils/appEventBus";
import { useGlobalUndoRedo } from "@/hooks/useGlobalUndoRedo";
import { isWindowsTheme } from "@/themes";

interface AppManagerProps {
apps: AnyApp[];
Expand Down Expand Up @@ -66,7 +67,7 @@ export function AppManager({ apps }: AppManagerProps) {

// Get current theme to determine if we should show the desktop menubar
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);

const [crashedInstanceIds, setCrashedInstanceIds] = useState<Set<string>>(
() => new Set()
Expand Down
3 changes: 2 additions & 1 deletion src/apps/base/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ export type AnyInitialData =
// For XP/98 themes, pass the menu bar as a prop to WindowFrame
// For other themes, render the menu bar normally outside WindowFrame
// Example:
// import { isWindowsTheme } from "@/themes";
// const currentTheme = useThemeStore((state) => state.current);
// const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
// const isXpTheme = isWindowsTheme(currentTheme);
// const menuBar = <AppMenuBar ... />;
// return (
// <>
Expand Down
3 changes: 2 additions & 1 deletion src/apps/calendar/components/EventDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
import { useThemeStore } from "@/stores/useThemeStore";
import { cn } from "@/lib/utils";
import type { CalendarEvent, EventColor, CalendarGroup } from "@/stores/useCalendarStore";
import { isWindowsTheme } from "@/themes";

interface EventDialogProps {
isOpen: boolean;
Expand Down Expand Up @@ -57,7 +58,7 @@ export function EventDialog({
}: EventDialogProps) {
const { t } = useTranslation();
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacTheme = currentTheme === "macosx";

const [title, setTitle] = useState("");
Expand Down
3 changes: 2 additions & 1 deletion src/apps/candybar/components/CandyBarMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "@/components/ui/menubar";
import { useThemeStore } from "@/stores/useThemeStore";
import { useTranslation } from "react-i18next";
import { isWindowsTheme } from "@/themes";

interface CandyBarMenuBarProps {
onClose: () => void;
Expand All @@ -30,7 +31,7 @@ export function CandyBarMenuBar({
}: CandyBarMenuBarProps) {
const { t } = useTranslation();
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOsxTheme = currentTheme === "macosx";

return (
Expand Down
3 changes: 2 additions & 1 deletion src/apps/candybar/hooks/useCandyBarLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { toast } from "sonner";
import { useTranslatedHelpItems } from "@/hooks/useTranslatedHelpItems";
import { useThemeStore } from "@/stores/useThemeStore";
import { helpItems } from "..";
import { isWindowsTheme } from "@/themes";

export interface IconPackIcon {
name: string;
Expand Down Expand Up @@ -49,7 +50,7 @@ export function useCandyBarLogic({
const { t } = useTranslation();
const translatedHelpItems = useTranslatedHelpItems("candybar", helpItems);
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOSXTheme = currentTheme === "macosx";

const [isHelpDialogOpen, setIsHelpDialogOpen] = useState(false);
Expand Down
3 changes: 2 additions & 1 deletion src/apps/chats/components/ChatsAppComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { useChatsFrameLayout } from "../hooks/useChatsFrameLayout";
import { useProactiveGreeting } from "../hooks/useProactiveGreeting";
import { useTelegramLink } from "@/hooks/useTelegramLink";
import { useGlobalPresence } from "@/hooks/useGlobalPresence";
import { isWindowsTheme } from "@/themes";

export function ChatsAppComponent({
isWindowOpen,
Expand Down Expand Up @@ -418,7 +419,7 @@ export function ChatsAppComponent({
}, [setIsNewRoomDialogOpen]);

const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isWindowsLegacyTheme = isXpTheme;
const isMacTheme = currentTheme === "macosx";
const isOffline = useOffline();
Expand Down
3 changes: 2 additions & 1 deletion src/apps/chats/components/CreateRoomDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useThemeStore } from "@/stores/useThemeStore";
import { cn } from "@/lib/utils";
import { useTranslation } from "react-i18next";
import { abortableFetch } from "@/utils/abortableFetch";
import { isWindowsTheme } from "@/themes";
import {
ThemedTabsList,
ThemedTabsTrigger,
Expand Down Expand Up @@ -60,7 +61,7 @@ export function CreateRoomDialog({

// Theme detection
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);

// Reset form when dialog opens
useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/apps/contacts/components/UserPicturePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { cn } from "@/lib/utils";
import { ALL_USER_PICTURES } from "@/utils/userPictures";
import { resizeImageToBase64 } from "@/utils/imageResize";
import { useTranslation } from "react-i18next";
import { isWindowsTheme } from "@/themes";

interface UserPicturePickerProps {
isOpen: boolean;
Expand All @@ -29,7 +30,7 @@ export function UserPicturePicker({
}: UserPicturePickerProps) {
const { t } = useTranslation();
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacTheme = currentTheme === "macosx";

const fontClassName = isXpTheme
Expand Down
3 changes: 2 additions & 1 deletion src/apps/control-panels/components/ControlPanelsMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useThemeStore } from "@/stores/useThemeStore";
import { ShareItemDialog } from "@/components/dialogs/ShareItemDialog";
import { appRegistry } from "@/config/appRegistry";
import { useTranslation } from "react-i18next";
import { isWindowsTheme } from "@/themes";

interface ControlPanelsMenuBarProps {
onClose: () => void;
Expand All @@ -29,7 +30,7 @@ export function ControlPanelsMenuBar({
const appId = "control-panels";
const appName = appRegistry[appId as keyof typeof appRegistry]?.name || appId;
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOsxTheme = currentTheme === "macosx";

return (
Expand Down
3 changes: 2 additions & 1 deletion src/apps/control-panels/hooks/useControlPanelsLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
isLogicalCloudSyncDomainEnabled,
type LogicalCloudSyncDomain,
} from "@/utils/syncLogicalDomains";
import { isWindowsTheme } from "@/themes";
import {
readStoreItems,
restoreStoreItems,
Expand Down Expand Up @@ -1492,7 +1493,7 @@ export function useControlPanelsLogic({
performFormat();
};

const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOSXTheme = currentTheme === "macosx";
const isSystem7Theme = currentTheme === "system7";
const isClassicMacTheme = isMacOSXTheme || isSystem7Theme;
Expand Down
3 changes: 2 additions & 1 deletion src/apps/dashboard/components/DashboardMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "@/components/ui/menubar";
import { useThemeStore } from "@/stores/useThemeStore";
import { useTranslation } from "react-i18next";
import { isWindowsTheme } from "@/themes";

interface DashboardMenuBarProps {
onClose: () => void;
Expand Down Expand Up @@ -43,7 +44,7 @@ export function DashboardMenuBar({
}: DashboardMenuBarProps) {
const { t } = useTranslation();
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOsxTheme = currentTheme === "macosx";

return (
Expand Down
3 changes: 2 additions & 1 deletion src/apps/finder/components/FileList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { getFinderDisplayName } from "@/utils/finderDisplay";
import { useThemeStore } from "@/stores/useThemeStore";
import type { LaunchOriginRect } from "@/stores/useAppStore";
import { useTranslation } from "react-i18next";
import { isWindowsTheme } from "@/themes";
import {
createSelectionRect,
getIntersectingSelectionIds,
Expand Down Expand Up @@ -383,7 +384,7 @@ export function FileList({
} | null>(null);
const currentTheme = useThemeStore((state) => state.current);
const isMacOSXTheme = currentTheme === "macosx";
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);

// Add refs for rename timing
const clickTimeoutRef = useRef<NodeJS.Timeout | null>(null);
Expand Down
3 changes: 2 additions & 1 deletion src/apps/finder/hooks/useFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
type CloudSyncDeletionBucket,
} from "@/stores/useCloudSyncStore";
import { useThemeStore } from "@/stores/useThemeStore";
import { isWindowsTheme } from "@/themes";

// Interface for content stored in IndexedDB
export interface DocumentContent {
Expand Down Expand Up @@ -872,7 +873,7 @@ export function useFileSystem(
name: "Macintosh HD",
isDirectory: true,
icon:
currentTheme === "xp" || currentTheme === "win98"
isWindowsTheme(currentTheme)
? "/icons/default/pc.png"
: "/icons/default/disk.png",
type: "directory",
Expand Down
3 changes: 2 additions & 1 deletion src/apps/finder/hooks/useFinderLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
} from "@/utils/appEventBus";
import { useAirDropStore } from "@/stores/useAirDropStore";
import { useChatsStore } from "@/stores/useChatsStore";
import { isWindowsTheme } from "@/themes";

type FinderUndoAction =
| { type: "moveToTrash"; fileName: string; originalPath: string }
Expand Down Expand Up @@ -1289,7 +1290,7 @@ export function useFinderLogic({
},
];

const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOSXTheme = currentTheme === "macosx";

// Sidebar state
Expand Down
3 changes: 2 additions & 1 deletion src/apps/infinite-mac/components/InfiniteMacMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { useThemeStore } from "@/stores/useThemeStore";
import { useTranslation } from "react-i18next";
import type { ScaleOption } from "../hooks/useInfiniteMacLogic";
import { isWindowsTheme } from "@/themes";

interface InfiniteMacMenuBarProps {
onClose: () => void;
Expand Down Expand Up @@ -43,7 +44,7 @@ export function InfiniteMacMenuBar({
}: InfiniteMacMenuBarProps) {
const { t } = useTranslation();
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const isMacOsxTheme = currentTheme === "macosx";

return (
Expand Down
3 changes: 2 additions & 1 deletion src/apps/infinite-mac/hooks/useInfiniteMacLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "@/stores/useInfiniteMacStore";
import { helpItems } from "../metadata";
import { useShallow } from "zustand/react/shallow";
import { isWindowsTheme } from "@/themes";

// Re-export types and presets for consumers
export type { ScaleOption, MacPreset, ScreenData } from "@/stores/useInfiniteMacStore";
Expand Down Expand Up @@ -106,7 +107,7 @@ export function useInfiniteMacLogic({

const { t } = useTranslation();
const currentTheme = useThemeStore((state) => state.current);
const isXpTheme = currentTheme === "xp" || currentTheme === "win98";
const isXpTheme = isWindowsTheme(currentTheme);
const translatedHelpItems = useTranslatedHelpItems("infinite-mac", helpItems);
const embedUrl = selectedPreset ? buildWrapperUrl(selectedPreset, currentScale) : null;

Expand Down
Loading
Loading