Skip to content

Commit 9e748e0

Browse files
PengyuChen01Sma1lboyautofix-ci[bot]
authored
feat(backend): vertical layout create button (#176)
### screenshot ![image](https://github.com/user-attachments/assets/39a214f5-feb8-4dea-bc05-77c55dc91f34) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new borderless button style that maintains a consistent, clean appearance during hover, focus, and active interactions. - Enhanced interactive elements with theme-aware styling, allowing buttons and icons to adapt dynamically between light and dark modes for a more intuitive user experience. - **Chores** - Updated `.gitignore` to include new entries for `container-state.json` and `port-state.json`. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Sma1lboy <[email protected]> Co-authored-by: Jackson Chen <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 9f9441a commit 9e748e0

File tree

3 files changed

+53
-17
lines changed

3 files changed

+53
-17
lines changed

frontend/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ next-env.d.ts
3838
# env
3939
.env
4040

41-
*.db
41+
*.db
42+
container-state.json
43+
port-state.json

frontend/src/app/globals.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,12 @@
164164
opacity: 0.85;
165165
}
166166
}
167+
168+
.button-no-border {
169+
@apply !border-none !outline-none !shadow-none;
170+
}
171+
.button-no-border:hover,
172+
.button-no-border:focus,
173+
.button-no-border:active {
174+
@apply !border-none !outline-none !shadow-none !ring-0;
175+
}

frontend/src/components/root/prompt-form.tsx

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { Button } from '@/components/ui/button';
3030
import { cn } from '@/lib/utils';
3131
import { useModels } from '@/hooks/useModels';
3232
import { gql, useMutation } from '@apollo/client';
33+
import { useTheme } from 'next-themes';
3334
import { logger } from '@/app/log/logger';
3435

3536
export interface PromptFormRef {
@@ -70,6 +71,9 @@ export const PromptForm = forwardRef<PromptFormRef, PromptFormProps>(
7071
// State for regeneration loading
7172
const [isRegenerating, setIsRegenerating] = useState(false);
7273

74+
const { theme } = useTheme();
75+
const isDarkMode = theme === 'dark';
76+
7377
const {
7478
selectedModel,
7579
setSelectedModel,
@@ -205,7 +209,7 @@ export const PromptForm = forwardRef<PromptFormRef, PromptFormProps>(
205209
</div>
206210

207211
{/* Controls section - now separated with a background */}
208-
<div className="absolute bottom-0 left-0 right-0 pb-3 px-3 flex pt-1 justify-between items-center bg-white dark:bg-gray-600 rounded-b-lg dark:border-gray-600">
212+
<div className="absolute bottom-0 left-0 right-0 py-1 px-3 flex items-center justify-between bg-white dark:bg-gray-600 rounded-b-lg dark:border-gray-600">
209213
<div className="flex items-center gap-2">
210214
<Select
211215
value={visibility}
@@ -283,25 +287,46 @@ export const PromptForm = forwardRef<PromptFormRef, PromptFormProps>(
283287
<TooltipProvider>
284288
<Tooltip>
285289
<TooltipTrigger asChild>
286-
<Button
287-
variant="ghost"
288-
size="icon"
290+
<div
291+
onClick={
292+
!isLoading && !isRegenerating && message.trim()
293+
? handleMagicEnhance
294+
: undefined
295+
}
289296
className={cn(
290-
'rounded-full p-2 transition-all',
297+
'flex items-center justify-center w-12 h-12 rounded-full p-2 cursor-pointer transition-all',
298+
'focus:outline-none focus:ring-0 focus:border-0',
299+
'active:outline-none active:ring-0 active:border-0',
291300
isEnhanced
292-
? 'bg-amber-500/20 text-amber-500 hover:bg-amber-500/30 hover:text-amber-600'
293-
: 'text-gray-500 hover:text-amber-500',
294-
(isLoading || isRegenerating) &&
301+
? isDarkMode
302+
? 'text-primary-100 hover:text-primary-100'
303+
: 'text-yellow-300 hover:text-yellow-300'
304+
: 'text-gray-500 hover:text-gray-500',
305+
(isLoading || isRegenerating || !message.trim()) &&
295306
'opacity-50 cursor-not-allowed'
296307
)}
297-
onClick={handleMagicEnhance}
298-
disabled={isLoading || isRegenerating}
308+
style={{
309+
border: 'none',
310+
outline: 'none',
311+
boxShadow: 'none',
312+
WebkitTapHighlightColor: 'transparent',
313+
WebkitAppearance: 'none',
314+
MozAppearance: 'none',
315+
WebkitUserSelect: 'none',
316+
userSelect: 'none',
317+
}}
318+
tabIndex={-1}
319+
onMouseDown={(e) => e.preventDefault()}
320+
onMouseUp={(e) => e.preventDefault()}
299321
>
300322
<Sparkles
301-
size={20}
302-
className={cn(isRegenerating && 'animate-spin')}
323+
size={24}
324+
className={cn(
325+
'w-5 h-5',
326+
isRegenerating && 'animate-spin'
327+
)}
303328
/>
304-
</Button>
329+
</div>
305330
</TooltipTrigger>
306331
<TooltipContent side="bottom">
307332
<p>
@@ -316,12 +341,12 @@ export const PromptForm = forwardRef<PromptFormRef, PromptFormProps>(
316341
{/* Submit button */}
317342
<Button
318343
className={cn(
319-
'bg-gradient-to-r from-primary-500 to-primary-600 hover:from-primary-600 hover:to-primary-700 text-white shadow-md hover:shadow-lg transition-all px-5 py-3 h-10 rounded-sm',
320-
(isLoading || isRegenerating) &&
344+
'bg-gradient-to-r from-primary-500 to-primary-600 hover:from-primary-600 hover:to-primary-700 text-white shadow-md hover:shadow-lg transition-all px-5 py-3 h-10 rounded-full',
345+
(isLoading || isRegenerating || !message.trim()) &&
321346
'opacity-80 cursor-not-allowed'
322347
)}
323348
onClick={handleSubmit}
324-
disabled={isLoading || isRegenerating}
349+
disabled={isLoading || isRegenerating || !message.trim()}
325350
>
326351
{isLoading ? (
327352
<>

0 commit comments

Comments
 (0)