Mayo commited on
Commit
e32f0fc
·
unverified ·
1 Parent(s): cf14138

chore: make toolbar more attractive

Browse files
ui/components/canvas/CanvasToolbar.tsx CHANGED
@@ -11,6 +11,7 @@ import {
11
  LoaderCircleIcon,
12
  LanguagesIcon,
13
  } from 'lucide-react'
 
14
  import { useAppStore } from '@/lib/store'
15
  import { useTextBlocks } from '@/hooks/useTextBlocks'
16
  import { OPENAI_COMPATIBLE_MODEL_ID } from '@/lib/openai'
@@ -74,7 +75,7 @@ const uniqueStrings = (values: string[]) => {
74
 
75
  export function CanvasToolbar() {
76
  return (
77
- <div className='border-border bg-card text-foreground flex items-center gap-2 border-b px-2 py-1.5 text-xs'>
78
  <WorkflowButtons />
79
  <div className='flex-1' />
80
  <LlmStatusPopover />
@@ -98,43 +99,49 @@ function WorkflowButtons() {
98
  }
99
  }
100
 
101
- const buttonClass =
102
- 'text-foreground/70 hover:text-foreground hover:bg-accent flex h-7 items-center gap-1.5 rounded px-2 text-xs transition'
103
-
104
  return (
105
- <div className='flex items-center'>
106
- <button onClick={detect} className={buttonClass}>
107
- <ScanIcon className='size-3.5' />
108
  {t('processing.detect')}
109
- </button>
 
 
110
 
111
- <button onClick={ocr} className={buttonClass}>
112
- <ScanTextIcon className='size-3.5' />
113
  {t('processing.ocr')}
114
- </button>
 
 
115
 
116
- <button
 
 
117
  onClick={handleTranslate}
118
  disabled={!llmReady || generating}
119
- className={`${buttonClass} disabled:cursor-not-allowed disabled:opacity-40`}
120
  >
121
  {generating ? (
122
- <LoaderCircleIcon className='size-3.5 animate-spin' />
123
  ) : (
124
- <LanguagesIcon className='size-3.5' />
125
  )}
126
  {t('llm.generate')}
127
- </button>
128
 
129
- <button onClick={inpaint} className={buttonClass}>
130
- <Wand2Icon className='size-3.5' />
 
 
131
  {t('mask.inpaint')}
132
- </button>
 
 
133
 
134
- <button onClick={render} className={buttonClass}>
135
- <TypeIcon className='size-3.5' />
136
  {t('llm.render')}
137
- </button>
138
  </div>
139
  )
140
  }
@@ -346,10 +353,10 @@ function LlmStatusPopover() {
346
  <Popover>
347
  <PopoverTrigger asChild>
348
  <button
349
- className={`flex h-6 cursor-pointer items-center gap-1 rounded-full px-2 text-[11px] font-medium transition hover:opacity-80 ${
350
  llmReady
351
- ? 'bg-rose-400 text-white'
352
- : 'bg-muted text-muted-foreground'
353
  }`}
354
  >
355
  <motion.span
 
11
  LoaderCircleIcon,
12
  LanguagesIcon,
13
  } from 'lucide-react'
14
+ import { Separator } from '@/components/ui/separator'
15
  import { useAppStore } from '@/lib/store'
16
  import { useTextBlocks } from '@/hooks/useTextBlocks'
17
  import { OPENAI_COMPATIBLE_MODEL_ID } from '@/lib/openai'
 
75
 
76
  export function CanvasToolbar() {
77
  return (
78
+ <div className='border-border/60 bg-card text-foreground flex items-center gap-2 border-b px-3 py-2 text-xs'>
79
  <WorkflowButtons />
80
  <div className='flex-1' />
81
  <LlmStatusPopover />
 
99
  }
100
  }
101
 
 
 
 
102
  return (
103
+ <div className='flex items-center gap-0.5'>
104
+ <Button variant='ghost' size='xs' onClick={detect}>
105
+ <ScanIcon className='size-4' />
106
  {t('processing.detect')}
107
+ </Button>
108
+
109
+ <Separator orientation='vertical' className='mx-0.5 h-4' />
110
 
111
+ <Button variant='ghost' size='xs' onClick={ocr}>
112
+ <ScanTextIcon className='size-4' />
113
  {t('processing.ocr')}
114
+ </Button>
115
+
116
+ <Separator orientation='vertical' className='mx-0.5 h-4' />
117
 
118
+ <Button
119
+ variant='ghost'
120
+ size='xs'
121
  onClick={handleTranslate}
122
  disabled={!llmReady || generating}
 
123
  >
124
  {generating ? (
125
+ <LoaderCircleIcon className='size-4 animate-spin' />
126
  ) : (
127
+ <LanguagesIcon className='size-4' />
128
  )}
129
  {t('llm.generate')}
130
+ </Button>
131
 
132
+ <Separator orientation='vertical' className='mx-0.5 h-4' />
133
+
134
+ <Button variant='ghost' size='xs' onClick={inpaint}>
135
+ <Wand2Icon className='size-4' />
136
  {t('mask.inpaint')}
137
+ </Button>
138
+
139
+ <Separator orientation='vertical' className='mx-0.5 h-4' />
140
 
141
+ <Button variant='ghost' size='xs' onClick={render}>
142
+ <TypeIcon className='size-4' />
143
  {t('llm.render')}
144
+ </Button>
145
  </div>
146
  )
147
  }
 
353
  <Popover>
354
  <PopoverTrigger asChild>
355
  <button
356
+ className={`flex h-6 cursor-pointer items-center gap-1.5 rounded-full px-2.5 text-[11px] font-medium shadow-sm transition hover:opacity-80 ${
357
  llmReady
358
+ ? 'bg-rose-400 text-white ring-1 ring-rose-400/30'
359
+ : 'bg-muted text-muted-foreground ring-border/50 ring-1'
360
  }`}
361
  >
362
  <motion.span