From 8a4c867a8afb77a6a6ce9a0c7f9e1351627100f0 Mon Sep 17 00:00:00 2001 From: ChrQR Date: Tue, 11 Jun 2024 13:28:09 +0200 Subject: [PATCH] added it jobbank --- next.config.mjs | 22 +++++++------ package-lock.json | 62 ++++++++++++++++++++++++++++++++++++ package.json | 1 + src/app/ITJobbank.tsx | 43 +++++++++++++++++++++++++ src/app/TabContainer.tsx | 24 ++++++++++++++ src/app/TheHub.tsx | 2 +- src/app/_jobcard/JobCard.tsx | 2 +- src/app/page.tsx | 4 +-- src/components/ui/tabs.tsx | 55 ++++++++++++++++++++++++++++++++ 9 files changed, 202 insertions(+), 13 deletions(-) create mode 100644 src/app/ITJobbank.tsx create mode 100644 src/app/TabContainer.tsx create mode 100644 src/components/ui/tabs.tsx diff --git a/next.config.mjs b/next.config.mjs index 1d36768..9d306c5 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,14 +1,18 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - images: { - remotePatterns: [ - { - protocol: 'https', - hostname: 'thehub-io.imgix.net', - pathname: '/files/s3/*', - }, - ], - }, + images: { + remotePatterns: [ + { + protocol: "https", + hostname: "thehub-io.imgix.net", + pathname: "/files/s3/*", + }, + { + protocol: "https", + hostname: "www.it-jobbank.dk", + }, + ], + }, }; export default nextConfig; diff --git a/package-lock.json b/package-lock.json index 20da803..4b1020c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-tabs": "^1.0.4", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "html-react-parser": "^5.1.10", @@ -670,6 +671,37 @@ } } }, + "node_modules/@radix-ui/react-roving-focus": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.0.4.tgz", + "integrity": "sha512-2mUg5Mgcu001VkGy+FfzZyzbmuUWzgWkj3rvv4yu+mLw03+mTzbxZHvfcGyFp2b8EkQeMkpRQ5FiA2Vr2O6TeQ==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-collection": "1.0.3", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-direction": "1.0.1", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-callback-ref": "1.0.1", + "@radix-ui/react-use-controllable-state": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-slot": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz", @@ -689,6 +721,36 @@ } } }, + "node_modules/@radix-ui/react-tabs": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tabs/-/react-tabs-1.0.4.tgz", + "integrity": "sha512-egZfYY/+wRNCflXNHx+dePvnz9FbmssDTJBtgRfDY7e8SE5oIo3Py2eCB1ckAbh1Q7cQ/6yJZThJ++sgbxibog==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-direction": "1.0.1", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-presence": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-roving-focus": "1.0.4", + "@radix-ui/react-use-controllable-state": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-use-callback-ref": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.0.1.tgz", diff --git a/package.json b/package.json index 5722695..b936b86 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-tabs": "^1.0.4", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "html-react-parser": "^5.1.10", diff --git a/src/app/ITJobbank.tsx b/src/app/ITJobbank.tsx new file mode 100644 index 0000000..fe8ad43 --- /dev/null +++ b/src/app/ITJobbank.tsx @@ -0,0 +1,43 @@ +import { revalidatePath } from "next/cache"; +import JobCard from "./_jobcard/JobCard"; + +interface JobPosting { + title: string; + logo: string; + company: string; + location: string; + type: string; + description: string; + link: string; + skills: { + react: boolean; + python: boolean; + golang: boolean; + svelte: boolean; + nextjs: boolean; + typescript: boolean; + tailwind: boolean; + }; +} + +async function fetchJobs(): Promise { + const response = await fetch("http://51.20.250.24/jobs/itjobbank"); + if (!response.ok) { + throw new Error("Failed to fetch jobs"); + } + + revalidatePath("/"); + return response.json(); +} + +export default async function ITJobbank() { + const jobs = await fetchJobs(); + return ( + <> +

IT Jobbank

+ {jobs.map((job, i) => ( + + ))} + + ); +} diff --git a/src/app/TabContainer.tsx b/src/app/TabContainer.tsx new file mode 100644 index 0000000..c1f1ece --- /dev/null +++ b/src/app/TabContainer.tsx @@ -0,0 +1,24 @@ +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import TheHub from "./TheHub"; +import ITJobbank from "./ITJobbank"; + +export default function TabContainer() { + return ( + + + + The Hub + + + IT-Jobbank + + + + + + + + + + ); +} diff --git a/src/app/TheHub.tsx b/src/app/TheHub.tsx index 7c22431..9c42164 100644 --- a/src/app/TheHub.tsx +++ b/src/app/TheHub.tsx @@ -21,7 +21,7 @@ interface JobPosting { } async function fetchJobs(): Promise { - const response = await fetch("http://51.20.250.24/jobs"); + const response = await fetch("http://51.20.250.24/jobs/hub"); if (!response.ok) { throw new Error("Failed to fetch jobs"); } diff --git a/src/app/_jobcard/JobCard.tsx b/src/app/_jobcard/JobCard.tsx index 5a6ffc6..15e8736 100644 --- a/src/app/_jobcard/JobCard.tsx +++ b/src/app/_jobcard/JobCard.tsx @@ -42,7 +42,7 @@ export default async function JobCard(props: { job: JobPosting }) {
{`${company}'s
@@ -12,7 +12,7 @@ export default async function Home() { they are posted!
- +
); diff --git a/src/components/ui/tabs.tsx b/src/components/ui/tabs.tsx new file mode 100644 index 0000000..d56f6b7 --- /dev/null +++ b/src/components/ui/tabs.tsx @@ -0,0 +1,55 @@ +"use client" + +import * as React from "react" +import * as TabsPrimitive from "@radix-ui/react-tabs" + +import { cn } from "@/lib/utils" + +const Tabs = TabsPrimitive.Root + +const TabsList = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsList.displayName = TabsPrimitive.List.displayName + +const TabsTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsTrigger.displayName = TabsPrimitive.Trigger.displayName + +const TabsContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsContent.displayName = TabsPrimitive.Content.displayName + +export { Tabs, TabsList, TabsTrigger, TabsContent }