Skip to content

Commit 64afb62

Browse files
committed
feat(web): Implement helm template page
1 parent 31fec00 commit 64afb62

4 files changed

Lines changed: 232 additions & 31 deletions

File tree

web/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
BugFix,
88
Docker,
99
EC2,
10+
HelmTemplate,
1011
IAM,
1112
Installation,
1213
S3,
@@ -21,6 +22,7 @@ function App() {
2122
<Route element={<MainLayout />}>
2223
<Route index element={<Basic />} />
2324
<Route path="bug-fix" element={<BugFix />} />
25+
<Route path="helm-template" element={<HelmTemplate />} />
2426
<Route path="terraform-template" element={<TerraformTemplate />}>
2527
<Route path="docker" element={<Docker />} />
2628
<Route path="ec2" element={<EC2 />} />

web/src/pages/bug-fix/bug-fix.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,97 +3,97 @@ import { Send } from 'lucide-react';
33

44
const BugFix: FC = () => {
55
return (
6-
<div className="flex items-center justify-center w-full h-full">
6+
<div className="flex h-full w-full items-center justify-center">
77
<div className="w-full max-w-[768px]">
8-
<div className="w-full p-2 rounded-md">
9-
<div className="flex items-center justify-center w-full h-full gap-3">
10-
<div className="flex flex-col w-full">
8+
<div className="w-full rounded-md p-2">
9+
<div className="flex h-full w-full items-center justify-center gap-3">
10+
<div className="flex w-full flex-col">
1111
<label htmlFor="min_token" className="mb-2">
1212
Min Token
1313
</label>
1414
<input
1515
id="min_token"
16-
className="w-full p-3 rounded-md outline-none"
16+
className="w-full rounded-md p-3 outline-none"
1717
/>
1818
</div>
19-
<div className="flex flex-col w-full">
19+
<div className="flex w-full flex-col">
2020
<label htmlFor="min_token" className="mb-2">
2121
Max Token
2222
</label>
2323
<input
2424
id="min_token"
25-
className="w-full p-3 rounded-md outline-none"
25+
className="w-full rounded-md p-3 outline-none"
2626
/>
2727
</div>
28-
<div className="flex flex-col w-full">
28+
<div className="flex w-full flex-col">
2929
<label htmlFor="min_token" className="mb-2">
3030
Service
3131
</label>
3232
<input
3333
id="min_token"
34-
className="w-full p-3 rounded-md outline-none"
34+
className="w-full rounded-md p-3 outline-none"
3535
/>
3636
</div>
37-
<div className="flex flex-col w-full">
37+
<div className="flex w-full flex-col">
3838
<label htmlFor="min_token" className="mb-2">
3939
Version
4040
</label>
4141
<input
4242
id="min_token"
43-
className="w-full p-3 rounded-md outline-none"
43+
className="w-full rounded-md p-3 outline-none"
4444
/>
4545
</div>
4646
</div>
4747
<div className="mt-4">
48-
<div className="w-full p-3 overflow-y-auto rounded-md scrollbar-corner-transparent scrollbar-thin scrollbar-track-transparent h-96 bg-slate-900">
49-
<div className="max-w-full chat chat-end">
50-
<div className="text-white bg-gray-600 chat-bubble">
48+
<div className="scrollbar-corner-transparent scrollbar-thin scrollbar-track-transparent h-96 w-full overflow-y-auto rounded-md bg-slate-900 p-3">
49+
<div className="chat chat-end max-w-full">
50+
<div className="chat-bubble bg-gray-600 text-white">
5151
You underestimate my power!
5252
</div>
5353
</div>
54-
<div className="max-w-full chat chat-start">
55-
<div className="text-white chat-bubble">
54+
<div className="chat chat-start max-w-full">
55+
<div className="chat-bubble text-white">
5656
You underestimate my power!
5757
</div>
5858
</div>
59-
<div className="max-w-full chat chat-end">
60-
<div className="text-white bg-gray-600 chat-bubble">
59+
<div className="chat chat-end max-w-full">
60+
<div className="chat-bubble bg-gray-600 text-white">
6161
You underestimate my power!
6262
</div>
6363
</div>
64-
<div className="max-w-full chat chat-start">
65-
<div className="text-white chat-bubble">
64+
<div className="chat chat-start max-w-full">
65+
<div className="chat-bubble text-white">
6666
You underestimate my power!
6767
</div>
6868
</div>
69-
<div className="max-w-full chat chat-end">
70-
<div className="text-white bg-gray-600 chat-bubble">
69+
<div className="chat chat-end max-w-full">
70+
<div className="chat-bubble bg-gray-600 text-white">
7171
You underestimate my power!
7272
</div>
7373
</div>
74-
<div className="max-w-full chat chat-start">
75-
<div className="text-white chat-bubble">
74+
<div className="chat chat-start max-w-full">
75+
<div className="chat-bubble text-white">
7676
You underestimate my power!
7777
</div>
7878
</div>
79-
<div className="max-w-full chat chat-end">
80-
<div className="text-white bg-gray-600 chat-bubble">
79+
<div className="chat chat-end max-w-full">
80+
<div className="chat-bubble bg-gray-600 text-white">
8181
You underestimate my power!
8282
</div>
8383
</div>
84-
<div className="max-w-full chat chat-start">
85-
<div className="text-white chat-bubble">
84+
<div className="chat chat-start max-w-full">
85+
<div className="chat-bubble text-white">
8686
You underestimate my power!
8787
</div>
8888
</div>
8989
</div>
9090
</div>
9191
<div className="relative mt-4">
9292
<textarea
93-
className="w-full p-4 pr-16 rounded-md outline-none resize-none"
93+
className="w-full resize-none rounded-md p-4 pr-16 outline-none"
9494
rows={2}
9595
/>
96-
<button className="absolute flex items-center justify-center p-2 bg-white rounded-full right-3 top-5">
96+
<button className="absolute right-3 top-5 flex items-center justify-center rounded-full bg-white p-2">
9797
<Send className="size-6 stroke-[#121212]" />
9898
</button>
9999
</div>
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
import { FC, useState } from 'react';
2+
import { Plus, Trash2 } from 'lucide-react';
3+
import { cn } from '@/lib/utils';
4+
5+
const HelmTemplate: FC = () => {
6+
const [environments, setEnvironments] = useState([
7+
{
8+
name: '',
9+
value: '',
10+
namePlaceholder: 'ENV1',
11+
valuePlaceholder: 'Hi',
12+
},
13+
]);
14+
const [stateless, setStateless] = useState(false);
15+
const [ingress, setIngress] = useState(false);
16+
17+
const handleAddEnvironment = () => {
18+
setEnvironments((prev) => [
19+
...prev,
20+
{
21+
name: '',
22+
value: '',
23+
namePlaceholder: `ENV${prev.length + 1}`,
24+
valuePlaceholder: 'Hi',
25+
},
26+
]);
27+
};
28+
29+
const handleRemoveEnvironment = (index: number) => {
30+
setEnvironments((prev) => prev.filter((_, i) => i !== index));
31+
};
32+
33+
return (
34+
<div className="scrollbar-thin flex h-[calc(100%-56px)] w-full items-center justify-center overflow-y-auto">
35+
<form className="flex h-full w-full max-w-[768px] flex-col justify-center">
36+
<div className="flex flex-col w-full mb-4">
37+
<label htmlFor="api_version" className="mb-1">
38+
Api Version
39+
</label>
40+
<input
41+
id="api_version"
42+
placeholder="2"
43+
className="w-full px-3 py-2 rounded-md outline-none"
44+
/>
45+
</div>
46+
<h1 className="mb-4 text-2xl font-bold">Pods</h1>
47+
<div className="flex flex-col mb-4">
48+
<label htmlFor="pods_name" className="mb-1">
49+
Name
50+
</label>
51+
<input
52+
id="pods_name"
53+
placeholder="2"
54+
className="w-full px-3 py-2 rounded-md outline-none"
55+
/>
56+
</div>
57+
<div className="flex flex-col mb-4">
58+
<label htmlFor="pods_image" className="mb-1">
59+
Image
60+
</label>
61+
<input
62+
id="pods_image"
63+
placeholder="nginx"
64+
className="w-full px-3 py-2 rounded-md outline-none"
65+
/>
66+
</div>
67+
<div className="flex flex-col mb-4">
68+
<label htmlFor="pods_target_port" className="mb-1">
69+
Target Port
70+
</label>
71+
<input
72+
id="pods_target_port"
73+
placeholder="nginx"
74+
className="w-full px-3 py-2 rounded-md outline-none"
75+
/>
76+
</div>
77+
<div className="flex flex-col mb-2">
78+
<label htmlFor="pods_replicas" className="mb-1">
79+
Replicas
80+
</label>
81+
<input
82+
id="pods_replicas"
83+
placeholder="1"
84+
className="w-full px-3 py-2 rounded-md outline-none"
85+
/>
86+
</div>
87+
<h2 className="mb-2 text-lg font-bold">Persistence</h2>
88+
<div className="flex flex-col mb-7">
89+
<label htmlFor="pods_persistence_size" className="mb-1">
90+
Size
91+
</label>
92+
<input
93+
id="pods_persistence_size"
94+
placeholder="iG1"
95+
className="w-full px-3 py-2 rounded-md outline-none"
96+
/>
97+
</div>
98+
<div className="flex flex-col mb-2">
99+
<label htmlFor="pods_accessModes" className="mb-1">
100+
Access Modes
101+
</label>
102+
<input
103+
id="pods_accessModes"
104+
placeholder="ReadWriteOnce"
105+
className="w-full px-3 py-2 rounded-md outline-none"
106+
/>
107+
</div>
108+
<div className="flex items-center mt-5 mb-2">
109+
<h3 className="text-lg font-bold">Environments</h3>
110+
<button className="ml-4 btn btn-xs" onClick={handleAddEnvironment}>
111+
Add <Plus className="size-3" />
112+
</button>
113+
</div>
114+
<div className="grid grid-cols-2 gap-4">
115+
{environments.map((env, index) => (
116+
<div
117+
className="flex items-center border border-gray-500 divide-x divide-gray-500 rounded-md"
118+
key={index}
119+
>
120+
<input
121+
value={env.name}
122+
placeholder={env.namePlaceholder}
123+
className="w-full h-12 px-2 outline-none rounded-s-md"
124+
/>
125+
<input
126+
value={env.value}
127+
placeholder={env.valuePlaceholder}
128+
className={cn('h-12 w-full px-2 outline-none', {
129+
'rounded-e-md': index === 0,
130+
})}
131+
/>
132+
{index > 0 && (
133+
<button
134+
onClick={() => handleRemoveEnvironment(index)}
135+
className="btn btn-error rounded-e-md rounded-s-none"
136+
>
137+
<Trash2 />
138+
</button>
139+
)}
140+
</div>
141+
))}
142+
</div>
143+
<div className="flex justify-between mb-2 mt-7">
144+
<label htmlFor="pods_stateless" className="mb-1">
145+
Stateless
146+
</label>
147+
<input
148+
id="pods_stateless"
149+
type="checkbox"
150+
className={cn('toggle border-gray-500 bg-gray-500', {
151+
'bg-orange-base hover:bg-orange-base/70': stateless,
152+
})}
153+
onChange={() => setStateless(!stateless)}
154+
/>
155+
</div>
156+
<h4 className="mt-5 text-lg font-bold">Ingress</h4>
157+
<div className="flex justify-between mt-3 mb-2">
158+
<label htmlFor="pods_ingress_enabled" className="mb-1">
159+
Enabled
160+
</label>
161+
<input
162+
id="pods_ingress_enabled"
163+
type="checkbox"
164+
className={cn('toggle border-gray-500 bg-gray-500', {
165+
'bg-orange-base hover:bg-orange-base/70': ingress,
166+
})}
167+
onChange={() => setIngress(!ingress)}
168+
/>
169+
</div>
170+
<div className="flex flex-col mt-3 mb-2">
171+
<label htmlFor="pods_ingress_host" className="mb-1">
172+
Host
173+
</label>
174+
<input
175+
id="pods_ingress_host"
176+
placeholder="www.example.com"
177+
className="w-full px-3 py-2 rounded-md outline-none"
178+
/>
179+
</div>
180+
<button className="w-full mt-3 text-white btn bg-orange-base hover:bg-orange-base/70">
181+
Submit
182+
</button>
183+
</form>
184+
</div>
185+
);
186+
};
187+
188+
export default HelmTemplate;

web/src/pages/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,16 @@ import S3 from './terraform-template/S3/s3';
66
import Installation from './installation/installation';
77
import Basic from './basic/basic';
88
import BugFix from './bug-fix/bug-fix';
9+
import HelmTemplate from './helm-template/helm-template';
910

10-
export { Argocd, Docker, EC2, IAM, S3, Installation, Basic, BugFix };
11+
export {
12+
Argocd,
13+
Docker,
14+
EC2,
15+
IAM,
16+
S3,
17+
Installation,
18+
Basic,
19+
BugFix,
20+
HelmTemplate,
21+
};

0 commit comments

Comments
 (0)