mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 00:55:14 -07:00
Refactor FloatingGenerateBox and HistoryTable components for improved UI consistency
- Removed unnecessary class from the FloatingGenerateBox button for cleaner styling. - Updated HistoryTable to remove redundant class from the delete button. - Reorganized imports in dropdown-menu for better readability. - Enhanced useAutoUpdater hook with improved dependency management and updated icon usage. - Deleted obsolete useAutoUpdater.ts file to streamline codebase.
This commit is contained in:
@@ -300,7 +300,7 @@ export function FloatingGenerateBox({
|
|||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isPending || !selectedProfileId}
|
disabled={isPending || !selectedProfileId}
|
||||||
className="h-10 w-10 rounded-full bg-accent hover:bg-accent/90 hover:scale-105 text-accent-foreground shadow-lg hover:shadow-accent/50 transition-all duration-200"
|
className="h-10 w-10 rounded-full bg-accent hover:bg-accent/90 hover:scale-105 text-accent-foreground shadow-lg transition-all duration-200"
|
||||||
size="icon"
|
size="icon"
|
||||||
>
|
>
|
||||||
{isPending ? (
|
{isPending ? (
|
||||||
|
|||||||
@@ -347,7 +347,6 @@ export function HistoryTable() {
|
|||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={() => handleDeleteClick(gen.id, gen.profile_name)}
|
onClick={() => handleDeleteClick(gen.id, gen.profile_name)}
|
||||||
disabled={deleteGeneration.isPending}
|
disabled={deleteGeneration.isPending}
|
||||||
className="text-destructive focus:text-destructive"
|
|
||||||
>
|
>
|
||||||
<HugeiconsIcon icon={Delete01Icon} size={16} className="mr-2 h-4 w-4" />
|
<HugeiconsIcon icon={Delete01Icon} size={16} className="mr-2 h-4 w-4" />
|
||||||
Delete
|
Delete
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
||||||
import { HugeiconsIcon } from '@hugeicons/react';
|
|
||||||
import { MoreHorizontalIcon } from '@hugeicons/core-free-icons';
|
import { MoreHorizontalIcon } from '@hugeicons/core-free-icons';
|
||||||
|
import { HugeiconsIcon } from '@hugeicons/react';
|
||||||
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
||||||
|
import * as React from 'react';
|
||||||
import { cn } from '@/lib/utils/cn';
|
import { cn } from '@/lib/utils/cn';
|
||||||
|
|
||||||
const DropdownMenu = DropdownMenuPrimitive.Root;
|
const DropdownMenu = DropdownMenuPrimitive.Root;
|
||||||
@@ -74,7 +74,7 @@ const DropdownMenuItem = React.forwardRef<
|
|||||||
<DropdownMenuPrimitive.Item
|
<DropdownMenuPrimitive.Item
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
||||||
inset && 'pl-8',
|
inset && 'pl-8',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
@@ -155,7 +155,9 @@ const DropdownMenuSeparator = React.forwardRef<
|
|||||||
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
||||||
|
|
||||||
const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
|
const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
|
||||||
return <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />;
|
return (
|
||||||
|
<span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />
|
||||||
|
);
|
||||||
};
|
};
|
||||||
DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
|
DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
|
||||||
|
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
||||||
import { usePlatform } from '@/platform/PlatformContext';
|
|
||||||
import type { UpdateStatus } from '@/platform/types';
|
|
||||||
|
|
||||||
// Re-export UpdateStatus for backwards compatibility
|
|
||||||
export type { UpdateStatus };
|
|
||||||
|
|
||||||
export function useAutoUpdater(checkOnMount = false) {
|
|
||||||
const platform = usePlatform();
|
|
||||||
const [status, setStatus] = useState<UpdateStatus>(platform.updater.getStatus());
|
|
||||||
const hasCheckedRef = useRef(false);
|
|
||||||
|
|
||||||
// Subscribe to updater status changes
|
|
||||||
useEffect(() => {
|
|
||||||
const unsubscribe = platform.updater.subscribe((newStatus) => {
|
|
||||||
setStatus(newStatus);
|
|
||||||
});
|
|
||||||
return unsubscribe;
|
|
||||||
// Empty dependency array - platform is stable from context
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [platform.updater.subscribe]);
|
|
||||||
|
|
||||||
const checkForUpdates = useCallback(async () => {
|
|
||||||
await platform.updater.checkForUpdates();
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [platform.updater.checkForUpdates]);
|
|
||||||
|
|
||||||
const downloadAndInstall = useCallback(async () => {
|
|
||||||
await platform.updater.downloadAndInstall();
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [platform.updater.downloadAndInstall]);
|
|
||||||
|
|
||||||
const restartAndInstall = useCallback(async () => {
|
|
||||||
await platform.updater.restartAndInstall();
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [platform.updater.restartAndInstall]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (checkOnMount && platform.metadata.isTauri && !hasCheckedRef.current) {
|
|
||||||
hasCheckedRef.current = true;
|
|
||||||
checkForUpdates();
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return {
|
|
||||||
status,
|
|
||||||
checkForUpdates,
|
|
||||||
downloadAndInstall,
|
|
||||||
restartAndInstall,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { HugeiconsIcon } from '@hugeicons/react';
|
|
||||||
import { Download01Icon, Refresh01Icon } from '@hugeicons/core-free-icons';
|
import { Download01Icon, Refresh01Icon } from '@hugeicons/core-free-icons';
|
||||||
|
import { HugeiconsIcon } from '@hugeicons/react';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { Progress } from '@/components/ui/progress';
|
import { Progress } from '@/components/ui/progress';
|
||||||
import { ToastAction } from '@/components/ui/toast';
|
import { ToastAction } from '@/components/ui/toast';
|
||||||
@@ -74,7 +74,7 @@ export function useAutoUpdater(options: boolean | UseAutoUpdaterOptions = false)
|
|||||||
}
|
}
|
||||||
// Empty dependency array - only run once on mount
|
// Empty dependency array - only run once on mount
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, [platform.metadata.isTauri, checkOnMount, checkForUpdates]);
|
||||||
|
|
||||||
// Show toast when update is available
|
// Show toast when update is available
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -133,7 +133,7 @@ export function useAutoUpdater(options: boolean | UseAutoUpdaterOptions = false)
|
|||||||
toastUpdateRef.current({
|
toastUpdateRef.current({
|
||||||
title: (
|
title: (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Download className="h-4 w-4 animate-pulse" />
|
<HugeiconsIcon icon={Download01Icon} size={16} className="h-4 w-4 animate-pulse" />
|
||||||
<span>Downloading Update</span>
|
<span>Downloading Update</span>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user