Skip to content

Commit

Permalink
feat: adapt web version dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
suemor233 committed Oct 28, 2024
1 parent 1c86690 commit 52c3110
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/tipc/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const appRoute = {
const result = await dialog.showMessageBox({
type: 'warning',
message: input.title,
buttons: ['确定','取消'],
buttons: ['取消', '确认'],
})
return !!result.response
}),
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/ui/select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger
ref={ref}
className={cn(
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
'flex h-10 w-full cursor-default items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
className,
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/ui/switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Switch = React.forwardRef<
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-cn-primary data-[state=unchecked]:bg-input',
'peer inline-flex h-6 w-11 shrink-0 cursor-default items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-cn-primary data-[state=unchecked]:bg-input',
className,
)}
{...props}
Expand Down
12 changes: 7 additions & 5 deletions src/renderer/src/hooks/use-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@ export const useDialog = () => {
title: params.title,
overlay: true,
content: ({ dismiss }) => (
<div>
<div className="mt-3 flex justify-end gap-2">
<Button
onClick={() => {
params.handleConfirm?.()
params.handleCancel?.()
dismiss()
}}
variant={'outline'}
>
Confirm
取消
</Button>
<Button
onClick={() => {
params.handleCancel?.()
params.handleConfirm?.()
dismiss()
}}
variant={'destructive'}
>
Cancel
确认
</Button>
</div>
),
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/page/history/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const FunctionArea = memo(() => {
<FunctionAreaButton
onClick={() =>
present({
title: '是否删除所有历史记录?',
title: '是否删除历史记录?',
handleConfirm: () => {
db.history.clear()
},
Expand Down

0 comments on commit 52c3110

Please sign in to comment.