balibabu
commited on
Commit
·
1b2bfb1
1
Parent(s):
305b8c0
feat: Add custom background color #3221 (#3336)
Browse files### What problem does this PR solve?
feat: Add custom background color #3221
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/package-lock.json +56 -0
- web/package.json +2 -0
- web/src/components/ui/avatar.tsx +50 -0
- web/src/components/ui/container.tsx +19 -0
- web/src/components/ui/segmented .tsx +51 -0
- web/src/components/ui/tabs.tsx +55 -0
- web/src/pages/home/card.tsx +39 -0
- web/src/pages/home/header.tsx +106 -0
- web/src/pages/home/index.tsx +15 -0
- web/src/routes.ts +5 -0
- web/tailwind.config.js +5 -1
- web/tailwind.css +6 -0
web/package-lock.json
CHANGED
@@ -13,6 +13,7 @@
|
|
13 |
"@hookform/resolvers": "^3.9.1",
|
14 |
"@js-preview/excel": "^1.7.8",
|
15 |
"@monaco-editor/react": "^4.6.0",
|
|
|
16 |
"@radix-ui/react-checkbox": "^1.1.2",
|
17 |
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
18 |
"@radix-ui/react-icons": "^1.3.1",
|
@@ -22,6 +23,7 @@
|
|
22 |
"@radix-ui/react-separator": "^1.1.0",
|
23 |
"@radix-ui/react-slot": "^1.1.0",
|
24 |
"@radix-ui/react-switch": "^1.1.1",
|
|
|
25 |
"@radix-ui/react-toast": "^1.2.2",
|
26 |
"@tanstack/react-query": "^5.40.0",
|
27 |
"@tanstack/react-query-devtools": "^5.51.5",
|
@@ -4083,6 +4085,31 @@
|
|
4083 |
}
|
4084 |
}
|
4085 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4086 |
"node_modules/@radix-ui/react-checkbox": {
|
4087 |
"version": "1.1.2",
|
4088 |
"resolved": "https://registry.npmmirror.com/@radix-ui/react-checkbox/-/react-checkbox-1.1.2.tgz",
|
@@ -4702,6 +4729,35 @@
|
|
4702 |
}
|
4703 |
}
|
4704 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4705 |
"node_modules/@radix-ui/react-toast": {
|
4706 |
"version": "1.2.2",
|
4707 |
"resolved": "https://registry.npmmirror.com/@radix-ui/react-toast/-/react-toast-1.2.2.tgz",
|
|
|
13 |
"@hookform/resolvers": "^3.9.1",
|
14 |
"@js-preview/excel": "^1.7.8",
|
15 |
"@monaco-editor/react": "^4.6.0",
|
16 |
+
"@radix-ui/react-avatar": "^1.1.1",
|
17 |
"@radix-ui/react-checkbox": "^1.1.2",
|
18 |
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
19 |
"@radix-ui/react-icons": "^1.3.1",
|
|
|
23 |
"@radix-ui/react-separator": "^1.1.0",
|
24 |
"@radix-ui/react-slot": "^1.1.0",
|
25 |
"@radix-ui/react-switch": "^1.1.1",
|
26 |
+
"@radix-ui/react-tabs": "^1.1.1",
|
27 |
"@radix-ui/react-toast": "^1.2.2",
|
28 |
"@tanstack/react-query": "^5.40.0",
|
29 |
"@tanstack/react-query-devtools": "^5.51.5",
|
|
|
4085 |
}
|
4086 |
}
|
4087 |
},
|
4088 |
+
"node_modules/@radix-ui/react-avatar": {
|
4089 |
+
"version": "1.1.1",
|
4090 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-avatar/-/react-avatar-1.1.1.tgz",
|
4091 |
+
"integrity": "sha512-eoOtThOmxeoizxpX6RiEsQZ2wj5r4+zoeqAwO0cBaFQGjJwIH3dIX0OCxNrCyrrdxG+vBweMETh3VziQG7c1kw==",
|
4092 |
+
"dependencies": {
|
4093 |
+
"@radix-ui/react-context": "1.1.1",
|
4094 |
+
"@radix-ui/react-primitive": "2.0.0",
|
4095 |
+
"@radix-ui/react-use-callback-ref": "1.1.0",
|
4096 |
+
"@radix-ui/react-use-layout-effect": "1.1.0"
|
4097 |
+
},
|
4098 |
+
"peerDependencies": {
|
4099 |
+
"@types/react": "*",
|
4100 |
+
"@types/react-dom": "*",
|
4101 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
4102 |
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4103 |
+
},
|
4104 |
+
"peerDependenciesMeta": {
|
4105 |
+
"@types/react": {
|
4106 |
+
"optional": true
|
4107 |
+
},
|
4108 |
+
"@types/react-dom": {
|
4109 |
+
"optional": true
|
4110 |
+
}
|
4111 |
+
}
|
4112 |
+
},
|
4113 |
"node_modules/@radix-ui/react-checkbox": {
|
4114 |
"version": "1.1.2",
|
4115 |
"resolved": "https://registry.npmmirror.com/@radix-ui/react-checkbox/-/react-checkbox-1.1.2.tgz",
|
|
|
4729 |
}
|
4730 |
}
|
4731 |
},
|
4732 |
+
"node_modules/@radix-ui/react-tabs": {
|
4733 |
+
"version": "1.1.1",
|
4734 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-tabs/-/react-tabs-1.1.1.tgz",
|
4735 |
+
"integrity": "sha512-3GBUDmP2DvzmtYLMsHmpA1GtR46ZDZ+OreXM/N+kkQJOPIgytFWWTfDQmBQKBvaFS0Vno0FktdbVzN28KGrMdw==",
|
4736 |
+
"dependencies": {
|
4737 |
+
"@radix-ui/primitive": "1.1.0",
|
4738 |
+
"@radix-ui/react-context": "1.1.1",
|
4739 |
+
"@radix-ui/react-direction": "1.1.0",
|
4740 |
+
"@radix-ui/react-id": "1.1.0",
|
4741 |
+
"@radix-ui/react-presence": "1.1.1",
|
4742 |
+
"@radix-ui/react-primitive": "2.0.0",
|
4743 |
+
"@radix-ui/react-roving-focus": "1.1.0",
|
4744 |
+
"@radix-ui/react-use-controllable-state": "1.1.0"
|
4745 |
+
},
|
4746 |
+
"peerDependencies": {
|
4747 |
+
"@types/react": "*",
|
4748 |
+
"@types/react-dom": "*",
|
4749 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
4750 |
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4751 |
+
},
|
4752 |
+
"peerDependenciesMeta": {
|
4753 |
+
"@types/react": {
|
4754 |
+
"optional": true
|
4755 |
+
},
|
4756 |
+
"@types/react-dom": {
|
4757 |
+
"optional": true
|
4758 |
+
}
|
4759 |
+
}
|
4760 |
+
},
|
4761 |
"node_modules/@radix-ui/react-toast": {
|
4762 |
"version": "1.2.2",
|
4763 |
"resolved": "https://registry.npmmirror.com/@radix-ui/react-toast/-/react-toast-1.2.2.tgz",
|
web/package.json
CHANGED
@@ -24,6 +24,7 @@
|
|
24 |
"@hookform/resolvers": "^3.9.1",
|
25 |
"@js-preview/excel": "^1.7.8",
|
26 |
"@monaco-editor/react": "^4.6.0",
|
|
|
27 |
"@radix-ui/react-checkbox": "^1.1.2",
|
28 |
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
29 |
"@radix-ui/react-icons": "^1.3.1",
|
@@ -33,6 +34,7 @@
|
|
33 |
"@radix-ui/react-separator": "^1.1.0",
|
34 |
"@radix-ui/react-slot": "^1.1.0",
|
35 |
"@radix-ui/react-switch": "^1.1.1",
|
|
|
36 |
"@radix-ui/react-toast": "^1.2.2",
|
37 |
"@tanstack/react-query": "^5.40.0",
|
38 |
"@tanstack/react-query-devtools": "^5.51.5",
|
|
|
24 |
"@hookform/resolvers": "^3.9.1",
|
25 |
"@js-preview/excel": "^1.7.8",
|
26 |
"@monaco-editor/react": "^4.6.0",
|
27 |
+
"@radix-ui/react-avatar": "^1.1.1",
|
28 |
"@radix-ui/react-checkbox": "^1.1.2",
|
29 |
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
30 |
"@radix-ui/react-icons": "^1.3.1",
|
|
|
34 |
"@radix-ui/react-separator": "^1.1.0",
|
35 |
"@radix-ui/react-slot": "^1.1.0",
|
36 |
"@radix-ui/react-switch": "^1.1.1",
|
37 |
+
"@radix-ui/react-tabs": "^1.1.1",
|
38 |
"@radix-ui/react-toast": "^1.2.2",
|
39 |
"@tanstack/react-query": "^5.40.0",
|
40 |
"@tanstack/react-query-devtools": "^5.51.5",
|
web/src/components/ui/avatar.tsx
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use client';
|
2 |
+
|
3 |
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
4 |
+
import * as React from 'react';
|
5 |
+
|
6 |
+
import { cn } from '@/lib/utils';
|
7 |
+
|
8 |
+
const Avatar = React.forwardRef<
|
9 |
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
10 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
11 |
+
>(({ className, ...props }, ref) => (
|
12 |
+
<AvatarPrimitive.Root
|
13 |
+
ref={ref}
|
14 |
+
className={cn(
|
15 |
+
'relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full',
|
16 |
+
className,
|
17 |
+
)}
|
18 |
+
{...props}
|
19 |
+
/>
|
20 |
+
));
|
21 |
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
22 |
+
|
23 |
+
const AvatarImage = React.forwardRef<
|
24 |
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
25 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
26 |
+
>(({ className, ...props }, ref) => (
|
27 |
+
<AvatarPrimitive.Image
|
28 |
+
ref={ref}
|
29 |
+
className={cn('aspect-square h-full w-full', className)}
|
30 |
+
{...props}
|
31 |
+
/>
|
32 |
+
));
|
33 |
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
34 |
+
|
35 |
+
const AvatarFallback = React.forwardRef<
|
36 |
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
37 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
38 |
+
>(({ className, ...props }, ref) => (
|
39 |
+
<AvatarPrimitive.Fallback
|
40 |
+
ref={ref}
|
41 |
+
className={cn(
|
42 |
+
'flex h-full w-full items-center justify-center rounded-full bg-muted',
|
43 |
+
className,
|
44 |
+
)}
|
45 |
+
{...props}
|
46 |
+
/>
|
47 |
+
));
|
48 |
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
49 |
+
|
50 |
+
export { Avatar, AvatarFallback, AvatarImage };
|
web/src/components/ui/container.tsx
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { cn } from '@/lib/utils';
|
2 |
+
|
3 |
+
export function Container({
|
4 |
+
children,
|
5 |
+
className,
|
6 |
+
...props
|
7 |
+
}: React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>) {
|
8 |
+
return (
|
9 |
+
<div
|
10 |
+
className={cn(
|
11 |
+
'px-2 py-1 bg-backgroundInverseStandard text-backgroundInverseStandard-foreground inline-flex items-center rounded-sm gap-2',
|
12 |
+
className,
|
13 |
+
)}
|
14 |
+
{...props}
|
15 |
+
>
|
16 |
+
{children}
|
17 |
+
</div>
|
18 |
+
);
|
19 |
+
}
|
web/src/components/ui/segmented .tsx
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { cn } from '@/lib/utils';
|
2 |
+
import * as React from 'react';
|
3 |
+
export declare type SegmentedValue = string | number;
|
4 |
+
export declare type SegmentedRawOption = SegmentedValue;
|
5 |
+
export interface SegmentedLabeledOption {
|
6 |
+
className?: string;
|
7 |
+
disabled?: boolean;
|
8 |
+
label: React.ReactNode;
|
9 |
+
value: SegmentedRawOption;
|
10 |
+
/**
|
11 |
+
* html `title` property for label
|
12 |
+
*/
|
13 |
+
title?: string;
|
14 |
+
}
|
15 |
+
declare type SegmentedOptions = (SegmentedRawOption | SegmentedLabeledOption)[];
|
16 |
+
export interface SegmentedProps
|
17 |
+
extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
|
18 |
+
options: SegmentedOptions;
|
19 |
+
defaultValue?: SegmentedValue;
|
20 |
+
value?: SegmentedValue;
|
21 |
+
onChange?: (value: SegmentedValue) => void;
|
22 |
+
disabled?: boolean;
|
23 |
+
prefixCls?: string;
|
24 |
+
direction?: 'ltr' | 'rtl';
|
25 |
+
motionName?: string;
|
26 |
+
}
|
27 |
+
|
28 |
+
export function Segmented({ options, value, onChange }: SegmentedProps) {
|
29 |
+
return (
|
30 |
+
<div className="flex items-center rounded-sm p-1 gap-2 bg-zinc-200">
|
31 |
+
{options.map((option) => {
|
32 |
+
const isObject = typeof option === 'object';
|
33 |
+
const actualValue = isObject ? option.value : option;
|
34 |
+
|
35 |
+
return (
|
36 |
+
<div
|
37 |
+
key={actualValue}
|
38 |
+
className={cn(
|
39 |
+
'inline-flex items-center px-2 py-1 text-sm font-medium rounded-sm cursor-pointer',
|
40 |
+
|
41 |
+
{ 'bg-indigo-400': value === actualValue },
|
42 |
+
)}
|
43 |
+
onClick={() => onChange?.(actualValue)}
|
44 |
+
>
|
45 |
+
{isObject ? option.label : option}
|
46 |
+
</div>
|
47 |
+
);
|
48 |
+
})}
|
49 |
+
</div>
|
50 |
+
);
|
51 |
+
}
|
web/src/components/ui/tabs.tsx
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use client';
|
2 |
+
|
3 |
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
4 |
+
import * as React from 'react';
|
5 |
+
|
6 |
+
import { cn } from '@/lib/utils';
|
7 |
+
|
8 |
+
const Tabs = TabsPrimitive.Root;
|
9 |
+
|
10 |
+
const TabsList = React.forwardRef<
|
11 |
+
React.ElementRef<typeof TabsPrimitive.List>,
|
12 |
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
13 |
+
>(({ className, ...props }, ref) => (
|
14 |
+
<TabsPrimitive.List
|
15 |
+
ref={ref}
|
16 |
+
className={cn(
|
17 |
+
'inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground',
|
18 |
+
className,
|
19 |
+
)}
|
20 |
+
{...props}
|
21 |
+
/>
|
22 |
+
));
|
23 |
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
24 |
+
|
25 |
+
const TabsTrigger = React.forwardRef<
|
26 |
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
27 |
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
28 |
+
>(({ className, ...props }, ref) => (
|
29 |
+
<TabsPrimitive.Trigger
|
30 |
+
ref={ref}
|
31 |
+
className={cn(
|
32 |
+
'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',
|
33 |
+
className,
|
34 |
+
)}
|
35 |
+
{...props}
|
36 |
+
/>
|
37 |
+
));
|
38 |
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
39 |
+
|
40 |
+
const TabsContent = React.forwardRef<
|
41 |
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
42 |
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
43 |
+
>(({ className, ...props }, ref) => (
|
44 |
+
<TabsPrimitive.Content
|
45 |
+
ref={ref}
|
46 |
+
className={cn(
|
47 |
+
'mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
48 |
+
className,
|
49 |
+
)}
|
50 |
+
{...props}
|
51 |
+
/>
|
52 |
+
));
|
53 |
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
54 |
+
|
55 |
+
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
web/src/pages/home/card.tsx
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Button } from '@/components/ui/button';
|
2 |
+
import {
|
3 |
+
Card,
|
4 |
+
CardContent,
|
5 |
+
CardDescription,
|
6 |
+
CardFooter,
|
7 |
+
CardHeader,
|
8 |
+
CardTitle,
|
9 |
+
} from '@/components/ui/card';
|
10 |
+
import { Input } from '@/components/ui/input';
|
11 |
+
import { Label } from '@/components/ui/label';
|
12 |
+
|
13 |
+
export function CardWithForm() {
|
14 |
+
return (
|
15 |
+
<Card className="w-[350px]">
|
16 |
+
<CardHeader>
|
17 |
+
<CardTitle>Create project</CardTitle>
|
18 |
+
<CardDescription>Deploy your new project in one-click.</CardDescription>
|
19 |
+
</CardHeader>
|
20 |
+
<CardContent>
|
21 |
+
<form>
|
22 |
+
<div className="grid w-full items-center gap-4">
|
23 |
+
<div className="flex flex-col space-y-1.5">
|
24 |
+
<Label htmlFor="name">Name</Label>
|
25 |
+
<Input id="name" placeholder="Name of your project" />
|
26 |
+
</div>
|
27 |
+
<div className="flex flex-col space-y-1.5">
|
28 |
+
<Label htmlFor="framework">Framework</Label>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
</form>
|
32 |
+
</CardContent>
|
33 |
+
<CardFooter className="flex justify-between">
|
34 |
+
<Button variant="outline">Cancel</Button>
|
35 |
+
<Button>Deploy</Button>
|
36 |
+
</CardFooter>
|
37 |
+
</Card>
|
38 |
+
);
|
39 |
+
}
|
web/src/pages/home/header.tsx
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
2 |
+
import { Button } from '@/components/ui/button';
|
3 |
+
import { Container } from '@/components/ui/container';
|
4 |
+
import { Segmented, SegmentedValue } from '@/components/ui/segmented ';
|
5 |
+
import { useTranslate } from '@/hooks/common-hooks';
|
6 |
+
import { useNavigateWithFromState } from '@/hooks/route-hook';
|
7 |
+
import {
|
8 |
+
Cpu,
|
9 |
+
Github,
|
10 |
+
Library,
|
11 |
+
MessageSquareText,
|
12 |
+
Search,
|
13 |
+
Star,
|
14 |
+
Zap,
|
15 |
+
} from 'lucide-react';
|
16 |
+
import { useCallback, useMemo, useState } from 'react';
|
17 |
+
import { useLocation } from 'umi';
|
18 |
+
|
19 |
+
export function HomeHeader() {
|
20 |
+
const { t } = useTranslate('header');
|
21 |
+
const { pathname } = useLocation();
|
22 |
+
const navigate = useNavigateWithFromState();
|
23 |
+
const [currentPath, setCurrentPath] = useState('/home');
|
24 |
+
|
25 |
+
const tagsData = useMemo(
|
26 |
+
() => [
|
27 |
+
{ path: '/home', name: t('knowledgeBase'), icon: Library },
|
28 |
+
{ path: '/chat', name: t('chat'), icon: MessageSquareText },
|
29 |
+
{ path: '/search', name: t('search'), icon: Search },
|
30 |
+
{ path: '/flow', name: t('flow'), icon: Cpu },
|
31 |
+
// { path: '/file', name: t('fileManager'), icon: FileIcon },
|
32 |
+
],
|
33 |
+
[t],
|
34 |
+
);
|
35 |
+
|
36 |
+
const options = useMemo(() => {
|
37 |
+
return tagsData.map((tag) => {
|
38 |
+
const HeaderIcon = tag.icon;
|
39 |
+
|
40 |
+
return {
|
41 |
+
label: (
|
42 |
+
<div className="flex items-center gap-1">
|
43 |
+
<HeaderIcon className="size-5"></HeaderIcon>
|
44 |
+
<span>{tag.name}</span>
|
45 |
+
</div>
|
46 |
+
),
|
47 |
+
value: tag.path,
|
48 |
+
};
|
49 |
+
});
|
50 |
+
}, [tagsData]);
|
51 |
+
|
52 |
+
// const currentPath = useMemo(() => {
|
53 |
+
// return tagsData.find((x) => pathname.startsWith(x.path))?.name || 'home';
|
54 |
+
// }, [pathname, tagsData]);
|
55 |
+
|
56 |
+
const handleChange = (path: SegmentedValue) => {
|
57 |
+
// navigate(path as string);
|
58 |
+
setCurrentPath(path as string);
|
59 |
+
};
|
60 |
+
|
61 |
+
const handleLogoClick = useCallback(() => {
|
62 |
+
navigate('/');
|
63 |
+
}, [navigate]);
|
64 |
+
|
65 |
+
return (
|
66 |
+
<section className="px-[60px] py-[12px] flex justify-between">
|
67 |
+
<div className="flex items-center gap-4">
|
68 |
+
<img
|
69 |
+
src={'/logo.svg'}
|
70 |
+
alt="logo"
|
71 |
+
className="w-[100] h-[100] mr-[12]"
|
72 |
+
onClick={handleLogoClick}
|
73 |
+
/>
|
74 |
+
<Button variant="secondary">
|
75 |
+
<Github />
|
76 |
+
21.5k stars
|
77 |
+
<Star />
|
78 |
+
</Button>
|
79 |
+
</div>
|
80 |
+
<div>
|
81 |
+
<Segmented
|
82 |
+
options={options}
|
83 |
+
value={currentPath}
|
84 |
+
onChange={handleChange}
|
85 |
+
></Segmented>
|
86 |
+
</div>
|
87 |
+
<div className="flex items-center gap-4">
|
88 |
+
<Button variant="secondary">V 0.13.0</Button>
|
89 |
+
<Container>
|
90 |
+
<Avatar className="w-[30px] h-[30px]">
|
91 |
+
<AvatarImage src="https://github.com/shadcn.png" />
|
92 |
+
<AvatarFallback>CN</AvatarFallback>
|
93 |
+
</Avatar>
|
94 | |
95 |
+
<Button
|
96 |
+
variant="destructive"
|
97 |
+
className="py-[2px] px-[8px] h-[23px] rounded-[4px]"
|
98 |
+
>
|
99 |
+
<Zap />
|
100 |
+
Pro
|
101 |
+
</Button>
|
102 |
+
</Container>
|
103 |
+
</div>
|
104 |
+
</section>
|
105 |
+
);
|
106 |
+
}
|
web/src/pages/home/index.tsx
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { CardWithForm } from './card';
|
2 |
+
import { HomeHeader } from './header';
|
3 |
+
|
4 |
+
const Home = () => {
|
5 |
+
return (
|
6 |
+
<div>
|
7 |
+
<HomeHeader></HomeHeader>
|
8 |
+
<section>
|
9 |
+
<CardWithForm></CardWithForm>
|
10 |
+
</section>
|
11 |
+
</div>
|
12 |
+
);
|
13 |
+
};
|
14 |
+
|
15 |
+
export default Home;
|
web/src/routes.ts
CHANGED
@@ -126,6 +126,11 @@ const routes = [
|
|
126 |
component: '@/pages/demo',
|
127 |
layout: false,
|
128 |
},
|
|
|
|
|
|
|
|
|
|
|
129 |
];
|
130 |
|
131 |
export default routes;
|
|
|
126 |
component: '@/pages/demo',
|
127 |
layout: false,
|
128 |
},
|
129 |
+
{
|
130 |
+
path: '/home',
|
131 |
+
layout: false,
|
132 |
+
component: '@/pages/home',
|
133 |
+
},
|
134 |
];
|
135 |
|
136 |
export default routes;
|
web/tailwind.config.js
CHANGED
@@ -3,7 +3,7 @@ const { fontFamily } = require('tailwindcss/defaultTheme');
|
|
3 |
/** @type {import('tailwindcss').Config} */
|
4 |
|
5 |
module.exports = {
|
6 |
-
darkMode: ['
|
7 |
content: [
|
8 |
'./src/pages/**/*.tsx',
|
9 |
'./src/components/**/*.tsx',
|
@@ -52,6 +52,10 @@ module.exports = {
|
|
52 |
DEFAULT: 'hsl(var(--card))',
|
53 |
foreground: 'hsl(var(--card-foreground))',
|
54 |
},
|
|
|
|
|
|
|
|
|
55 |
},
|
56 |
borderRadius: {
|
57 |
lg: `var(--radius)`,
|
|
|
3 |
/** @type {import('tailwindcss').Config} */
|
4 |
|
5 |
module.exports = {
|
6 |
+
darkMode: ['selector'],
|
7 |
content: [
|
8 |
'./src/pages/**/*.tsx',
|
9 |
'./src/components/**/*.tsx',
|
|
|
52 |
DEFAULT: 'hsl(var(--card))',
|
53 |
foreground: 'hsl(var(--card-foreground))',
|
54 |
},
|
55 |
+
backgroundInverseStandard: {
|
56 |
+
DEFAULT: 'var(--background-inverse-standard)',
|
57 |
+
foreground: 'var(--background-inverse-standard-foreground)',
|
58 |
+
},
|
59 |
},
|
60 |
borderRadius: {
|
61 |
lg: `var(--radius)`,
|
web/tailwind.css
CHANGED
@@ -34,6 +34,9 @@
|
|
34 |
--ring: 215 20.2% 65.1%;
|
35 |
|
36 |
--radius: 0.5rem;
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
.dark {
|
@@ -67,6 +70,9 @@
|
|
67 |
--ring: 216 34% 17%;
|
68 |
|
69 |
--radius: 0.5rem;
|
|
|
|
|
|
|
70 |
}
|
71 |
}
|
72 |
|
|
|
34 |
--ring: 215 20.2% 65.1%;
|
35 |
|
36 |
--radius: 0.5rem;
|
37 |
+
|
38 |
+
--background-inverse-standard: rgba(58, 56, 65, 0.15);
|
39 |
+
--background-inverse-standard-foreground: rgb(92, 81, 81);
|
40 |
}
|
41 |
|
42 |
.dark {
|
|
|
70 |
--ring: 216 34% 17%;
|
71 |
|
72 |
--radius: 0.5rem;
|
73 |
+
|
74 |
+
--background-inverse-standard: rgba(230, 227, 246, 0.15);
|
75 |
+
--background-inverse-standard-foreground: rgba(255, 255, 255, 1);
|
76 |
}
|
77 |
}
|
78 |
|