Skip to content

Commit 42cd56d

Browse files
Merge branch 'codu-code:develop' into fix-1102-implment-wysiwyg-to-see-article-exactly
2 parents 560a7f7 + 474c544 commit 42cd56d

File tree

9 files changed

+214
-89
lines changed

9 files changed

+214
-89
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191

9292
- name: Seed database
9393
run: |
94-
npm run db:push
94+
npm run db:migrate
9595
npm run db:seed
9696
9797
- name: Run Playwright tests

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ For a more detailed how to guide on setting them up [go to the Environment Varia
4848
6. Setup the tables in the database with Drizzle by running:
4949

5050
```bash
51-
npm run db:push
51+
npm run db:migrate
5252
```
5353

5454
The full command can be seen in our [package.json](/package.json#16) file

app/(app)/jobs/create/_client.tsx

Lines changed: 121 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import {
77
CheckboxGroup,
88
} from "@/components/ui-components/checkbox";
99
import { Divider } from "@/components/ui-components/divider";
10-
import { Description, Field, Label } from "@/components/ui-components/fieldset";
10+
import {
11+
Description,
12+
ErrorMessage,
13+
Field,
14+
Label,
15+
} from "@/components/ui-components/fieldset";
1116
import { Heading, Subheading } from "@/components/ui-components/heading";
1217
import { Input } from "@/components/ui-components/input";
1318
import {
@@ -17,22 +22,50 @@ import {
1722
} from "@/components/ui-components/radio";
1823
import { Strong, Text } from "@/components/ui-components/text";
1924
import { Textarea } from "@/components/ui-components/textarea";
25+
import { saveJobsInput, saveJobsSchema } from "@/schema/job";
2026
import { FEATURE_FLAGS, isFlagEnabled } from "@/utils/flags";
27+
import { zodResolver } from "@hookform/resolvers/zod";
2128
import Image from "next/image";
2229
import { notFound } from "next/navigation";
2330
import React, { useRef, useState } from "react";
31+
import { Controller, SubmitHandler, useForm } from "react-hook-form";
2432

2533
export default function Content() {
34+
const {
35+
register,
36+
handleSubmit,
37+
reset,
38+
control,
39+
formState: { errors, isSubmitting },
40+
} = useForm<saveJobsInput>({
41+
resolver: zodResolver(saveJobsSchema),
42+
defaultValues: {
43+
companyName: "",
44+
jobTitle: "",
45+
jobDescription: "",
46+
jobLocation: "",
47+
applicationUrl: "",
48+
remote: false,
49+
relocation: false,
50+
visa_sponsorship: false,
51+
jobType: "full-time",
52+
},
53+
});
2654
const flagEnabled = isFlagEnabled(FEATURE_FLAGS.JOBS);
2755
const fileInputRef = useRef<HTMLInputElement>(null);
2856
const [imgUrl, setImgUrl] = useState<string | null>(null);
29-
57+
const onSubmit: SubmitHandler<saveJobsInput> = (values) => {
58+
console.log(values);
59+
};
3060
if (!flagEnabled) {
3161
notFound();
3262
}
3363

3464
return (
35-
<form className="mx-auto max-w-4xl p-3 pt-8 sm:px-4">
65+
<form
66+
className="mx-auto max-w-4xl p-3 pt-8 sm:px-4"
67+
onSubmit={handleSubmit(onSubmit)}
68+
>
3669
<Heading level={1}>Post a job</Heading>
3770
<Divider className="my-10 mt-6" />
3871
<section className="grid gap-x-8 gap-y-6 sm:grid-cols-2">
@@ -89,9 +122,12 @@ export default function Content() {
89122
type="text"
90123
placeholder="Pixel Pulse Studios"
91124
autoComplete="given-company-name"
125+
{...register("companyName")}
92126
/>
127+
{errors?.companyName && (
128+
<ErrorMessage>{errors.companyName.message}</ErrorMessage>
129+
)}
93130
</Field>
94-
{/* Add error part after validation here */}
95131
</section>
96132

97133
<Divider className="my-10" soft />
@@ -107,9 +143,12 @@ export default function Content() {
107143
type="text"
108144
placeholder="Reality Architect"
109145
autoComplete="given-job-title"
146+
{...register("jobTitle")}
110147
/>
148+
{errors?.jobTitle && (
149+
<ErrorMessage>{errors.jobTitle.message}</ErrorMessage>
150+
)}
111151
</Field>
112-
{/* Add error part after validation here */}
113152
</section>
114153

115154
<Divider className="my-10" soft />
@@ -123,11 +162,13 @@ export default function Content() {
123162
<Textarea
124163
id="job-description"
125164
placeholder="As a Reality Architect, you'll be at the forefront of creating immersive mixed reality experiences that blur the line between the digital and physical..."
126-
resizable={false}
127165
rows={3}
166+
{...register("jobDescription")}
128167
/>
168+
{errors?.jobDescription && (
169+
<ErrorMessage>{errors.jobDescription.message}</ErrorMessage>
170+
)}
129171
</Field>
130-
{/* Add error part after validation here */}
131172
</section>
132173

133174
<Divider className="my-10" soft />
@@ -140,23 +181,46 @@ export default function Content() {
140181
</Text>
141182
</div>
142183
<Field>
143-
<Input placeholder="Dublin (2 days in the office per week)" />
184+
<Input
185+
placeholder="Dublin (2 days in the office per week)"
186+
{...register("jobLocation")}
187+
/>
144188
<CheckboxGroup className="mt-3">
145189
<CheckboxField>
146-
<Checkbox name="remote" value="is_remote" />
190+
<Controller
191+
name="remote"
192+
control={control}
193+
render={({ field }) => (
194+
<Checkbox checked={field.value} onChange={field.onChange} />
195+
)}
196+
/>
147197
<Label>Work is remote</Label>
148198
</CheckboxField>
149199
<CheckboxField>
150-
<Checkbox name="relocation" value="is_relocation_package" />
200+
<Controller
201+
name="relocation"
202+
control={control}
203+
render={({ field }) => (
204+
<Checkbox checked={field.value} onChange={field.onChange} />
205+
)}
206+
/>
151207
<Label>Relocation package given</Label>
152208
</CheckboxField>
153209
<CheckboxField>
154-
<Checkbox name="visa" value="is_visa_sponsored" />
210+
<Controller
211+
name="visa_sponsorship"
212+
control={control}
213+
render={({ field }) => (
214+
<Checkbox checked={field.value} onChange={field.onChange} />
215+
)}
216+
/>
155217
<Label>Visa sponsorship provided</Label>
156218
</CheckboxField>
157219
</CheckboxGroup>
220+
{errors?.jobLocation && (
221+
<ErrorMessage>{errors.jobLocation.message}</ErrorMessage>
222+
)}
158223
</Field>
159-
{/* Add error part after validation here */}
160224
</section>
161225

162226
<Divider className="my-10" soft />
@@ -172,9 +236,12 @@ export default function Content() {
172236
type="text"
173237
autoComplete="url"
174238
placeholder="https://example.com"
239+
{...register("applicationUrl")}
175240
/>
241+
{errors?.applicationUrl && (
242+
<ErrorMessage>{errors.applicationUrl.message}</ErrorMessage>
243+
)}
176244
</Field>
177-
{/* Add error part after validation here */}
178245
</section>
179246

180247
<Divider className="my-10" soft />
@@ -185,34 +252,42 @@ export default function Content() {
185252
<Text>Full-time, part-time or freelancer</Text>
186253
</div>
187254
<Field>
188-
<RadioGroup defaultValue="full_time">
189-
<RadioField>
190-
<Radio value="full_time" />
191-
<Label>Full-time (€150)</Label>
192-
<Description>Salaried Position</Description>
193-
</RadioField>
194-
<RadioField>
195-
<Radio value="part_time" />
196-
<Label>Part-time (€100)</Label>
197-
<Description>
198-
Salaried position but less than 4 days per week
199-
</Description>
200-
</RadioField>
201-
<RadioField>
202-
<Radio value="freelancer" />
203-
<Label>Freelancer (€100)</Label>
204-
<Description>Shorter-term usually or fixed term/job</Description>
205-
</RadioField>
206-
<RadioField>
207-
<Radio value="other_role_type" />
208-
<Label>Other (€100)</Label>
209-
<Description>
210-
Looking for a co-founder or something else we haven’t thought of
211-
</Description>
212-
</RadioField>
213-
</RadioGroup>
255+
<Controller
256+
name="jobType"
257+
control={control}
258+
render={({ field }) => (
259+
<RadioGroup value={field.value} onChange={field.onChange}>
260+
<RadioField>
261+
<Radio value="full-time" />
262+
<Label>Full-time (€150)</Label>
263+
<Description>Salaried Position</Description>
264+
</RadioField>
265+
<RadioField>
266+
<Radio value="part-time" />
267+
<Label>Part-time (€100)</Label>
268+
<Description>
269+
Salaried position but less than 4 days per week
270+
</Description>
271+
</RadioField>
272+
<RadioField>
273+
<Radio value="freelancer" />
274+
<Label>Freelancer (€100)</Label>
275+
<Description>
276+
Shorter-term usually or fixed term/job
277+
</Description>
278+
</RadioField>
279+
<RadioField>
280+
<Radio value="other" />
281+
<Label>Other (€100)</Label>
282+
<Description>
283+
Looking for a co-founder or something else we haven’t
284+
thought of
285+
</Description>
286+
</RadioField>
287+
</RadioGroup>
288+
)}
289+
/>
214290
</Field>
215-
{/* Add error part after validation here */}
216291
</section>
217292

218293
<Divider className="my-10" soft />
@@ -252,13 +327,17 @@ export default function Content() {
252327
practices.
253328
</Text>
254329
</div>
255-
{/* Add error part after validation here */}
256330
</section>
257331

258332
<Divider className="my-10" soft />
259333

260334
<div className="flex justify-end">
261-
<Button className="rounded-md" color="pink">
335+
<Button
336+
className="rounded-md"
337+
color="pink"
338+
type="submit"
339+
disabled={isSubmitting}
340+
>
262341
Submit and checkout
263342
</Button>
264343
</div>

app/(app)/not-found.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import NotFound from "@/components/NotFound/NotFound";
2+
3+
const notfound = () => {
4+
return <NotFound />;
5+
};
6+
7+
export default notfound;

app/not-found.tsx

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,7 @@
1-
"use client";
1+
import NotFound from "@/components/NotFound/NotFound";
22

3-
import Link from "next/link";
4-
import Image from "next/image";
3+
const notfound = () => {
4+
return <NotFound />;
5+
};
56

6-
export default function NotFound() {
7-
return (
8-
<main className="flex w-full flex-grow flex-col justify-center bg-white px-4 py-20 sm:px-6 lg:py-40">
9-
<div className="flex flex-shrink-0 justify-center">
10-
<Link href="/">
11-
<span className="sr-only">Codú</span>
12-
<Image
13-
src="/images/codu-black.png"
14-
alt="Codú logo"
15-
height={60}
16-
width={189}
17-
/>
18-
</Link>
19-
</div>
20-
<div className="py-16">
21-
<div className="text-center">
22-
<p className="bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text text-xl font-semibold uppercase leading-6 tracking-wide text-transparent">
23-
404 error
24-
</p>
25-
<h1 className="mt-2 text-4xl font-extrabold tracking-tight text-black sm:text-5xl">
26-
Page not found.
27-
</h1>
28-
<p className="mt-2 text-base text-neutral-500">
29-
Sorry, we couldn’t find the page you’re looking for.
30-
</p>
31-
<div className="mt-6">
32-
<Link
33-
className="bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text text-base font-semibold tracking-wide text-transparent"
34-
href="/"
35-
>
36-
Return home<span aria-hidden="true"> &rarr;</span>
37-
</Link>
38-
</div>
39-
</div>
40-
</div>
41-
</main>
42-
);
43-
}
7+
export default notfound;

components/NotFound/NotFound.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"use client";
2+
3+
import Link from "next/link";
4+
import Image from "next/image";
5+
6+
export default function NotFound() {
7+
return (
8+
<main className="flex w-full flex-grow flex-col justify-center bg-white px-4 py-20 sm:px-6 lg:py-40">
9+
<div className="flex flex-shrink-0 justify-center">
10+
<Link href="/">
11+
<span className="sr-only">Codú</span>
12+
<Image
13+
src="/images/codu-black.png"
14+
alt="Codú logo"
15+
height={60}
16+
width={189}
17+
/>
18+
</Link>
19+
</div>
20+
<div className="py-16">
21+
<div className="text-center">
22+
<p className="bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text text-xl font-semibold uppercase leading-6 tracking-wide text-transparent">
23+
404 error
24+
</p>
25+
<h1 className="mt-2 text-4xl font-extrabold tracking-tight text-black sm:text-5xl">
26+
Page not found.
27+
</h1>
28+
<p className="mt-2 text-base text-neutral-500">
29+
Sorry, we couldn’t find the page you’re looking for.
30+
</p>
31+
<div className="mt-6">
32+
<Link
33+
className="bg-gradient-to-r from-orange-400 to-pink-600 bg-clip-text text-base font-semibold tracking-wide text-transparent"
34+
href="/"
35+
>
36+
Return home<span aria-hidden="true"> &rarr;</span>
37+
</Link>
38+
</div>
39+
</div>
40+
</div>
41+
</main>
42+
);
43+
}

public/site.webmanifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"type": "image/png"
1414
}
1515
],
16-
"theme_color": "#ffffff",
17-
"background_color": "#ffffff",
16+
"theme_color": "#000000",
17+
"background_color": "#000000",
1818
"display": "standalone"
1919
}

0 commit comments

Comments
 (0)