From 95fce1d555d083d75e0110270f3af04ac7b259ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Eriksson?= Date: Tue, 3 Sep 2024 10:21:19 +0200 Subject: [PATCH] [frontend] UI and UX Fixes Improved Usability of UI, including improving the dark mode and how elements are displayed --- frontend/.firebase/hosting.cHVibGlj.cache | 47 +++++----- frontend/.firebaserc | 11 ++- frontend/.gitignore | 5 ++ frontend/firebase-debug.log | 25 ------ frontend/firebase.json | 14 ++- frontend/package-lock.json | 3 + frontend/public/404.html | 33 ------- frontend/public/index.html | 89 ------------------- frontend/src/api/index.ts | 3 +- frontend/src/app/[language]/account/base.tsx | 2 +- .../account/pages/account/accountForm.tsx | 32 +++++-- .../[language]/account/pages/calendarPage.tsx | 10 ++- frontend/src/app/[language]/admin/admin.tsx | 5 +- .../src/app/[language]/bulletin/events.tsx | 10 ++- .../app/[language]/bulletin/news/allNews.tsx | 4 +- .../news/upload/[slug]/pages/article.tsx | 4 + .../app/[language]/bulletin/recruiting.tsx | 2 +- .../src/app/[language]/chapter/committees.tsx | 3 +- .../committees/[committee]/members.tsx | 4 +- .../chapter/documents/client/sidebarAuth.tsx | 34 +++---- .../chapter/documents/client/toolbar.tsx | 4 +- .../src/app/[language]/chapter/members.tsx | 10 ++- .../[language]/education/client/courses.tsx | 2 +- .../[language]/education/client/masters.tsx | 6 +- .../app/[language]/education/education.tsx | 17 ++-- frontend/src/app/[language]/layout.tsx | 4 +- frontend/src/app/[language]/login/login.tsx | 16 ++-- .../student/[studentId]/client/editButton.tsx | 1 + frontend/src/app/layout.tsx | 4 +- frontend/src/app/robots.ts | 4 +- frontend/src/app/sitemap.ts | 24 ++--- .../src/components/dialogs/EventUpload.tsx | 2 +- frontend/src/components/footer/Footer.tsx | 2 +- frontend/src/components/footer/connect.tsx | 7 +- frontend/src/components/static/Static.tsx | 29 +----- frontend/src/components/tags/CommitteeTag.tsx | 3 +- frontend/src/middleware.ts | 2 +- frontend/src/utility/Constants.ts | 2 +- 38 files changed, 189 insertions(+), 290 deletions(-) delete mode 100644 frontend/firebase-debug.log delete mode 100644 frontend/public/404.html delete mode 100644 frontend/public/index.html diff --git a/frontend/.firebase/hosting.cHVibGlj.cache b/frontend/.firebase/hosting.cHVibGlj.cache index 38f5eb55..7e395c9d 100644 --- a/frontend/.firebase/hosting.cHVibGlj.cache +++ b/frontend/.firebase/hosting.cHVibGlj.cache @@ -1,32 +1,31 @@ -index.html,1725154496799,d9d7bc4ab8a92b15cc2009280fe4aea0d497560fe7b84d597ebcd2ad04f7c317 -404.html,1725154496712,762bf484ba67404bd1a3b181546ea28d60dfddf18e9dd4795d8d25bcf3c1a890 -images/logo.webp,1720431006580,2e2ed372391f67e94e94c4e0fecb24320da557538daa7fb4eabf4b7f411e9681 -images/svg/youtube.svg,1710785650591,e9016d78170c690d49d935a91bd81e02a734d4abafc67b0747ae8e803c827aab -images/svg/ths.svg,1717953182261,5b1b5af7e08278a04437bfe6030dfce7ea53232079ad7388f70ee247c90dac8b -images/svg/linkedin.svg,1710787637900,d01bff426eb95b311bccd560e257c1a426d0789b3721b80b8aa6e2223e363a3f -images/svg/mbd.svg,1711051608799,6d486107a644d05cc58f7ecc67eeb6f433540450d21835b17a1cecbf7b972e35 -images/svg/medieteknik.svg,1717953208687,20a606c6b0f7ab0fbb9092d9f70c6a76c33a366768dd5ce7cd1a4aade30a10c5 -images/svg/instagram.svg,1710785600065,a093432cf165a98aa1a6b49122fe951860ca71dd9d4727a45ca9ec388b39544c -images/cs.jpg,1708855444172,3a8f31249f57a708100ed5e597bbd003e8d706d9a6318436299ccef0934da9ce -images/svg/datateknik.svg,1717954310511,7e222db520ffa91ed3eadfd3fa85812a277a5bf45ae8630d5a98f4306f332c26 +screenshots/phone.webp,1720428750813,09a5b82e9868b09f5a93ff1398bb8212ec54b74cdd8a64a3db8723de953016c5 +screenshots/desktop.webp,1720428118145,fb766eed3c7cb6c53358353f3c0d83346d55c386f8b8a543926266ec71872a5b +images/ths_placeholder.jpg,1709687564492,af2c7227a1247730687e733f1daff25129f7f3ddd4497d2dab6c3afd2f6e2356 +images/testbg.jpg,1709696850461,02ac934a8ce6cb7efa6917f3c7853e084a969d34d4cd4cf635f53fe983b068c9 +images/sd.jpg,1709014945099,fa0727975b29d57738a268da4e7e262cdcb75b061285bc8ef1b0d39bed9322c7 +images/ml.jpg,1708856962239,8138b0b058ca7752ee40cc32cc4aa25d9d854d5165e4880d5d32e82aafaa6be7 images/logobig_light.jpg,1713814110573,25b0591ae761e535a9ef043dd0740647fa78b3df140442cd4390656040e45665 images/logobig_dark.jpg,1714179224566,9d5e1feb5cd3ca7b6a70f0118bf9c159e4f73e6c245dd1c942bf8788bad2d903 images/logobig.png,1710782675272,7bc0f40f5bf714f1b70ccb4fbc1f0a6627afcb3136b2aad436b8ca678294a15a -images/svg/facebook.svg,1710784995921,410040bc378c6c86fd75695f1f2a4eb749ad0ad1c53dfbe451d7f4981960086b -images/ict.jpg,1708856955078,8a840e4b6ca2f83901c1e34ec8abd8fd9802343d39c5fb7dc94443d79ea65ee3 -images/sd.jpg,1709014945099,fa0727975b29d57738a268da4e7e262cdcb75b061285bc8ef1b0d39bed9322c7 -screenshots/phone.webp,1720428750813,09a5b82e9868b09f5a93ff1398bb8212ec54b74cdd8a64a3db8723de953016c5 -images/ml.jpg,1708856962239,8138b0b058ca7752ee40cc32cc4aa25d9d854d5165e4880d5d32e82aafaa6be7 -images/svg/kth.svg,1711063787967,04db06aa8f5073b9693efb4ffa236e1df2fca8776a31265bde377c07fb8950d7 -images/imt.jpg,1708856946101,503fec3af341c92bfb964b5f7332cd773429e63dfbd059599dcd79a7de1becae +images/logo.webp,1720431006580,2e2ed372391f67e94e94c4e0fecb24320da557538daa7fb4eabf4b7f411e9681 images/KTH.jpg,1711828165385,4f497bda7e0c7f3b997214c01c0dcc389a5546218ff43275ec7a40a75b0bd93f -screenshots/desktop.webp,1720428118145,fb766eed3c7cb6c53358353f3c0d83346d55c386f8b8a543926266ec71872a5b -images/testbg.jpg,1709696850461,02ac934a8ce6cb7efa6917f3c7853e084a969d34d4cd4cf635f53fe983b068c9 -images/ths_placeholder.jpg,1709687564492,af2c7227a1247730687e733f1daff25129f7f3ddd4497d2dab6c3afd2f6e2356 -images/kth-landskap.jpg,1711819019756,b28a8cb7a0e430bf961ecf7870100d1b83ab8660476a1fca0b36f73aa313d20a images/kth-landskap.webp,1721805296540,5c9b68ff00d4ea5981d7776bc57f0bb5acca568e57175c974c54993d0934d8d3 +images/kth-landskap.jpg,1711819019756,b28a8cb7a0e430bf961ecf7870100d1b83ab8660476a1fca0b36f73aa313d20a images/international_placeholder.jpg,1709687695136,ca11b7b0dc9562294ad4b1e0d778243b1b4cdb1d7daf8bb5f6f7749f6ffc3976 -images/bg.webp,1720432387556,56af6239eed0080c917231b4e1e2fabfea36de843c5004b92e9941461e81c11f -images/testbg2.jpg,1696497351214,ba0e6b61f35bde9dd9949426da569529ec7b33d63fbdbab307b99a0b14217046 +images/imt.jpg,1708856946101,503fec3af341c92bfb964b5f7332cd773429e63dfbd059599dcd79a7de1becae +images/ict.jpg,1708856955078,8a840e4b6ca2f83901c1e34ec8abd8fd9802343d39c5fb7dc94443d79ea65ee3 +images/cs.jpg,1708855444172,3a8f31249f57a708100ed5e597bbd003e8d706d9a6318436299ccef0934da9ce images/bg2.webp,1723934109217,5848c87093a6345d24e8891469b68ab4916aba33add37dd0faa4b5d1d9491119 images/bg2.jpg,1723589234023,b05c4b16cfe029c4a04ec98a3d92dd767efc0ce149d46fc31f46b48902d1feb9 +images/bg.webp,1720432387556,56af6239eed0080c917231b4e1e2fabfea36de843c5004b92e9941461e81c11f +images/svg/youtube.svg,1710785650591,e9016d78170c690d49d935a91bd81e02a734d4abafc67b0747ae8e803c827aab +images/svg/ths.svg,1717953182261,5b1b5af7e08278a04437bfe6030dfce7ea53232079ad7388f70ee247c90dac8b +images/svg/medieteknik.svg,1717953208687,20a606c6b0f7ab0fbb9092d9f70c6a76c33a366768dd5ce7cd1a4aade30a10c5 +images/svg/mbd.svg,1711051608799,6d486107a644d05cc58f7ecc67eeb6f433540450d21835b17a1cecbf7b972e35 +images/svg/linkedin.svg,1710787637900,d01bff426eb95b311bccd560e257c1a426d0789b3721b80b8aa6e2223e363a3f +images/svg/kth.svg,1711063787967,04db06aa8f5073b9693efb4ffa236e1df2fca8776a31265bde377c07fb8950d7 +images/svg/instagram.svg,1710785600065,a093432cf165a98aa1a6b49122fe951860ca71dd9d4727a45ca9ec388b39544c +images/svg/facebook.svg,1710784995921,410040bc378c6c86fd75695f1f2a4eb749ad0ad1c53dfbe451d7f4981960086b +images/svg/datateknik.svg,1717954310511,7e222db520ffa91ed3eadfd3fa85812a277a5bf45ae8630d5a98f4306f332c26 +index.html,1725155380688,25675684f0fb77c2522f06d811feb465048ba95f6d82ef213e938a15b044c9c9 +404.html,1725155380688,41d1e074106979fb6591ec6953bfe5ace2788be22f0ed4189bd54905ebb5b44d diff --git a/frontend/.firebaserc b/frontend/.firebaserc index aac32933..9372cb7c 100644 --- a/frontend/.firebaserc +++ b/frontend/.firebaserc @@ -1,5 +1,12 @@ { "projects": { "default": "medieteknik" - } -} + }, + "targets": {}, + "etags": { + "medieteknik": { + "extensionInstances": {} + } + }, + "dataconnectEmulatorConfig": {} +} \ No newline at end of file diff --git a/frontend/.gitignore b/frontend/.gitignore index fd3dbb57..d0d9cd64 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -13,6 +13,11 @@ /.next/ /out/ +# firebase +/.firebaserc +/.firebase/ +/firebase.json + # production /build diff --git a/frontend/firebase-debug.log b/frontend/firebase-debug.log deleted file mode 100644 index a8c41515..00000000 --- a/frontend/firebase-debug.log +++ /dev/null @@ -1,25 +0,0 @@ -[debug] [2024-09-01T01:41:52.373Z] ---------------------------------------------------------------------- -[debug] [2024-09-01T01:41:52.375Z] Command: C:\Program Files\nodejs\node.exe C:\Users\andre\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js init hosting:github -[debug] [2024-09-01T01:41:52.375Z] CLI Version: 13.16.0 -[debug] [2024-09-01T01:41:52.375Z] Platform: win32 -[debug] [2024-09-01T01:41:52.376Z] Node Version: v21.5.0 -[debug] [2024-09-01T01:41:52.376Z] Time: Sun Sep 01 2024 03:41:52 GMT+0200 (Central European Summer Time) -[debug] [2024-09-01T01:41:52.376Z] ---------------------------------------------------------------------- -[debug] -[debug] [2024-09-01T01:41:52.432Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"] -[debug] [2024-09-01T01:41:52.433Z] > authorizing via signed-in user (webmaster@medieteknik.com) -[info] - ######## #### ######## ######## ######## ### ###### ######## - ## ## ## ## ## ## ## ## ## ## ## - ###### ## ######## ###### ######## ######### ###### ###### - ## ## ## ## ## ## ## ## ## ## ## - ## #### ## ## ######## ######## ## ## ###### ######## - -You're about to initialize a Firebase project in this directory: - - D:\Programming\Medieteknik\medieteknik.com\frontend - -Before we get started, keep in mind: - - * You are initializing within an existing Firebase project directory - diff --git a/frontend/firebase.json b/frontend/firebase.json index 621dfef6..949c8f54 100644 --- a/frontend/firebase.json +++ b/frontend/firebase.json @@ -1,11 +1,21 @@ { "hosting": { - "public": "public", + "source": ".", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" - ] + ], + "frameworksBackend": { + "region": "europe-west1", + "nextjs": { + "source": "src", + "functionConfig": { + "memory": "512MB", + "timeoutSeconds": 120 + } + } + } }, "remoteconfig": { "template": "remoteconfig.template.json" diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d6c34846..5f9381e5 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -7,6 +7,9 @@ "": { "name": "frontend", "version": "0.1.0", + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, "dependencies": { "@heroicons/react": "^2.1.1", "@hookform/resolvers": "^3.3.4", diff --git a/frontend/public/404.html b/frontend/public/404.html deleted file mode 100644 index 829eda8f..00000000 --- a/frontend/public/404.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - Page Not Found - - - - -
-

404

-

Page Not Found

-

The specified file was not found on this website. Please check the URL for mistakes and try again.

-

Why am I seeing this?

-

This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html file in your project's configured public directory.

-
- - diff --git a/frontend/public/index.html b/frontend/public/index.html deleted file mode 100644 index 1d52c3b0..00000000 --- a/frontend/public/index.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - Welcome to Firebase Hosting - - - - - - - - - - - - - - - - - - - -
-

Welcome

-

Firebase Hosting Setup Complete

-

You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!

- Open Hosting Documentation -
-

Firebase SDK Loading…

- - - - diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 756ba5a5..b033e706 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -1,7 +1,8 @@ +import { API_BASE_URL } from '@/utility/Constants'; import axios from 'axios'; const api = axios.create({ - baseURL: 'http://localhost:8000/api/v1', + baseURL: API_BASE_URL, }); export default api \ No newline at end of file diff --git a/frontend/src/app/[language]/account/base.tsx b/frontend/src/app/[language]/account/base.tsx index fc9533c4..0d13f22b 100644 --- a/frontend/src/app/[language]/account/base.tsx +++ b/frontend/src/app/[language]/account/base.tsx @@ -87,7 +87,7 @@ export default function Base({ ] const additionalPages: AccountPage[] = [] - if (permissions && permissions.author.length >= 1) { + if (permissions.author && permissions.author.length >= 1) { additionalPages.push({ name: 'items', icon: DocumentDuplicateIcon, diff --git a/frontend/src/app/[language]/account/pages/account/accountForm.tsx b/frontend/src/app/[language]/account/pages/account/accountForm.tsx index efaf4937..44ee610b 100644 --- a/frontend/src/app/[language]/account/pages/account/accountForm.tsx +++ b/frontend/src/app/[language]/account/pages/account/accountForm.tsx @@ -28,7 +28,9 @@ import useSWR from 'swr' import Loading from '@/components/tooltips/Loading' const fetcher = (url: string) => - fetch(url).then( + fetch(url, { + credentials: 'include', + }).then( (res) => res.json() as Promise<{ token: string @@ -69,14 +71,10 @@ export default function AccountForm({ ] const AccountFormSchema = z.object({ - profilePicture: z.instanceof(window.File), + profilePicture: z.instanceof(window.File).optional(), emailTwo: z.string().email().optional().or(z.literal('')), emailThree: z.string().email().optional().or(z.literal('')), - currentPassword: z - .string({ - required_error: 'Password is required to edit account settings', - }) - .min(3), + currentPassword: z.string().min(3).optional().or(z.literal('')), newPassword: z .string() .min(8) @@ -138,10 +136,23 @@ export default function AccountForm({ const postAccountForm = async (data: z.infer) => { const formData = new FormData() - formData.append('profile_picture', data.profilePicture) + if ( + !data.profilePicture && + !data.emailTwo && + !data.emailThree && + !data.currentPassword && + !data.newPassword + ) { + alert('No changes were made') + return + } + + if (data.profilePicture) + formData.append('profile_picture', data.profilePicture) if (data.emailTwo) formData.append('email_two', data.emailTwo) if (data.emailThree) formData.append('email_three', data.emailThree) - formData.append('current_password', data.currentPassword) + if (data.currentPassword) + formData.append('current_password', data.currentPassword) if (data.newPassword) formData.append('new_password', data.newPassword) formData.append('csrf_token', data.csrf_token || csrf.token) @@ -353,6 +364,9 @@ export default function AccountForm({ name='newPassword' render={({ field }) => ( + + Leave blank if you do not want to change your password + - {permissions.author.includes('EVENT') ? ( + {permissions.author && + permissions.author.includes('EVENT') ? ( ) : ( @@ -269,7 +270,8 @@ export default function CalendarPage({ language }: { language: string }) {

You{' '} - {permissions.author.includes('EVENT') + {permissions.author && + permissions.author.includes('EVENT') ? 'can' : 'cannot'} {' '} @@ -280,7 +282,7 @@ export default function CalendarPage({ language }: { language: string }) { className='flex items-center gap-2' title='Contact an administrator to gain access' > - {permissions.student.includes( + {permissions.student && permissions.student.includes( Permission.CALENDAR_PRIVATE ) ? ( @@ -290,7 +292,7 @@ export default function CalendarPage({ language }: { language: string }) {

You{' '} - {permissions.student.includes( + {permissions.student && permissions.student.includes( Permission.CALENDAR_PRIVATE ) ? 'can' diff --git a/frontend/src/app/[language]/admin/admin.tsx b/frontend/src/app/[language]/admin/admin.tsx index 2e645274..f3e5397b 100644 --- a/frontend/src/app/[language]/admin/admin.tsx +++ b/frontend/src/app/[language]/admin/admin.tsx @@ -28,7 +28,6 @@ import { } from '@heroicons/react/24/outline' import { Input } from '@/components/ui/input' import { Button } from '@/components/ui/button' -import Dashboard from './pages/dashboard' import Link from 'next/link' export default function Admin({ @@ -72,9 +71,7 @@ export default function Admin({

- - - +

diff --git a/frontend/src/app/[language]/bulletin/events.tsx b/frontend/src/app/[language]/bulletin/events.tsx index d032dc8d..67f44008 100644 --- a/frontend/src/app/[language]/bulletin/events.tsx +++ b/frontend/src/app/[language]/bulletin/events.tsx @@ -140,7 +140,8 @@ export default function Events({ className='flex items-center gap-2' title='Contact an administrator to gain access' > - {permissions.author.includes('EVENT') ? ( + {permissions.author && + permissions.author.includes('EVENT') ? ( ) : ( @@ -148,7 +149,8 @@ export default function Events({

You{' '} - {permissions.author.includes('EVENT') + {permissions.author && + permissions.author.includes('EVENT') ? 'can' : 'cannot'} {' '} @@ -170,7 +172,9 @@ export default function Events({

- {student && permissions.author.includes('EVENT') ? ( + {student && + permissions.author && + permissions.author.includes('EVENT') ? ( - {student && permissions.author.includes('NEWS') ? ( + {student && + permissions.author && + permissions.author.includes('NEWS') ? ( diff --git a/frontend/src/app/[language]/bulletin/news/upload/[slug]/pages/article.tsx b/frontend/src/app/[language]/bulletin/news/upload/[slug]/pages/article.tsx index c186a612..a6be42d9 100644 --- a/frontend/src/app/[language]/bulletin/news/upload/[slug]/pages/article.tsx +++ b/frontend/src/app/[language]/bulletin/news/upload/[slug]/pages/article.tsx @@ -249,6 +249,9 @@ export default function ArticlePage({ author: { author_type: 'COMMITTEE_POSITION', email: '', + base: false, + category: 'STYRELSEN', + committee_position_id: '', active: true, role: 'ADMIN', weight: 0, @@ -273,6 +276,7 @@ export default function ArticlePage({ tag: { author: { author_type: 'STUDENT', + student_id: '', email: '', first_name: detail, last_name: '', diff --git a/frontend/src/app/[language]/bulletin/recruiting.tsx b/frontend/src/app/[language]/bulletin/recruiting.tsx index e7dbbd90..715bcb78 100644 --- a/frontend/src/app/[language]/bulletin/recruiting.tsx +++ b/frontend/src/app/[language]/bulletin/recruiting.tsx @@ -68,7 +68,7 @@ export default function Recruitment({ includeBackground={false} > (
diff --git a/frontend/src/app/[language]/chapter/committees/[committee]/members.tsx b/frontend/src/app/[language]/chapter/committees/[committee]/members.tsx index d2f3bd07..82c62c80 100644 --- a/frontend/src/app/[language]/chapter/committees/[committee]/members.tsx +++ b/frontend/src/app/[language]/chapter/committees/[committee]/members.tsx @@ -82,13 +82,13 @@ export default async function CommitteeMembers({

-

+

{member.student.first_name + ' ' + member.student.last_name}

{member.position.email} diff --git a/frontend/src/app/[language]/chapter/documents/client/sidebarAuth.tsx b/frontend/src/app/[language]/chapter/documents/client/sidebarAuth.tsx index 81101c1f..2af5dc3c 100644 --- a/frontend/src/app/[language]/chapter/documents/client/sidebarAuth.tsx +++ b/frontend/src/app/[language]/chapter/documents/client/sidebarAuth.tsx @@ -13,22 +13,24 @@ export default function SidebarAuth({ language }: { language: string }) { const { addDocument } = useDocumentManagement() return ( <> - {student && permissions.author.includes('DOCUMENT') && ( - <> - - - - - setOpen(false)} - /> - - - - )} + {student && + permissions.author && + permissions.author.includes('DOCUMENT') && ( + <> + + + + + setOpen(false)} + /> + + + + )} ) } diff --git a/frontend/src/app/[language]/chapter/documents/client/toolbar.tsx b/frontend/src/app/[language]/chapter/documents/client/toolbar.tsx index 9b144ccf..dbd2d1ac 100644 --- a/frontend/src/app/[language]/chapter/documents/client/toolbar.tsx +++ b/frontend/src/app/[language]/chapter/documents/client/toolbar.tsx @@ -84,7 +84,9 @@ export default function Toolbar({ language }: { language: string }) {
- {permissions.author.includes('DOCUMENT') && + {permissions.author && + permissions.student && + permissions.author.includes('DOCUMENT') && permissions.student.includes('ITEMS_DELETE') && ( diff --git a/frontend/src/app/[language]/chapter/members.tsx b/frontend/src/app/[language]/chapter/members.tsx index 0970d1b4..3cc65b7d 100644 --- a/frontend/src/app/[language]/chapter/members.tsx +++ b/frontend/src/app/[language]/chapter/members.tsx @@ -188,7 +188,9 @@ export default function CommitteeMembers({ language }: { language: string }) { !member.termination_date) ) .sort((a, b) => - a.student.first_name.localeCompare(b.student.first_name) + a.position.translations[0].title.localeCompare( + b.position.translations[0].title + ) ) .sort((a, b) => a.position.weight - b.position.weight) .map((member, index) => ( @@ -213,7 +215,7 @@ export default function CommitteeMembers({ language }: { language: string }) {
- + @@ -245,7 +247,7 @@ export default function CommitteeMembers({ language }: { language: string }) {

-

+

{member.student.first_name + ' ' + member.student.last_name} diff --git a/frontend/src/app/[language]/education/client/courses.tsx b/frontend/src/app/[language]/education/client/courses.tsx index 6953c950..f8f7acfe 100644 --- a/frontend/src/app/[language]/education/client/courses.tsx +++ b/frontend/src/app/[language]/education/client/courses.tsx @@ -164,7 +164,7 @@ export default function Courses({

diff --git a/frontend/src/app/[language]/education/education.tsx b/frontend/src/app/[language]/education/education.tsx index c28cbc7e..bf4e4feb 100644 --- a/frontend/src/app/[language]/education/education.tsx +++ b/frontend/src/app/[language]/education/education.tsx @@ -83,7 +83,6 @@ export default function Education({
-

Lena Smedenborn Γ€r studievΓ€gledare fΓΆr studenter pΓ₯ @@ -94,29 +93,37 @@ export default function Education({

-
+
svl-media@kth.se
-
+

08-790 84 07

-
+

Rum 1434, LindstedtsvΓ€gen 3, plan 4

+ + + Se hela profilen pΓ₯ KTH.se +
diff --git a/frontend/src/app/[language]/layout.tsx b/frontend/src/app/[language]/layout.tsx index 8db5dfb1..ed5c4ca0 100644 --- a/frontend/src/app/[language]/layout.tsx +++ b/frontend/src/app/[language]/layout.tsx @@ -29,9 +29,11 @@ export async function generateStaticParams(): Promise< export const metadata: Metadata = { title: 'Medieteknik | KTH', - description: 'Medieteknik Site', + description: + 'Student pΓ₯ KTH? HΓ€r hittar du allt du behΓΆver veta om medieteknik pΓ₯ KTH.', other: { 'msapplication-TileColor': '#ffffff', + 'google-adsense-account': 'ca-pub-2106963438710910', }, } diff --git a/frontend/src/app/[language]/login/login.tsx b/frontend/src/app/[language]/login/login.tsx index cb5f84b5..0b78df33 100644 --- a/frontend/src/app/[language]/login/login.tsx +++ b/frontend/src/app/[language]/login/login.tsx @@ -1,8 +1,8 @@ +'use client' import Image from 'next/image' import KTHSVG from 'public/images/svg/kth.svg' import Link from 'next/link' import LoginForm from './client/loginForm' - import LightLogo from 'public/images/logobig_light.jpg' import DarkLogo from 'public/images/logobig_dark.jpg' import { Button } from '@/components/ui/button' @@ -22,6 +22,14 @@ interface Props { * @returns {JSX.Element} The login page */ export default function Login({ params: { language } }: Props): JSX.Element { + const loginKTH = () => { + const redirectURL = + process.env.NODE_ENV === 'production' + ? 'https://api.medieteknik.com/auth' + : 'http://localhost:3000/auth' + window.location.href = `${redirectURL}` + } + return (
@@ -59,17 +67,13 @@ export default function Login({ params: { language } }: Props): JSX.Element {
  • - - Disabled for now -
diff --git a/frontend/src/components/footer/connect.tsx b/frontend/src/components/footer/connect.tsx index 182c089c..9cbad49c 100644 --- a/frontend/src/components/footer/connect.tsx +++ b/frontend/src/components/footer/connect.tsx @@ -5,6 +5,7 @@ import YoutubeSVG from 'public/images/svg/youtube.svg' import MBDSVG from 'public/images/svg/mbd.svg' import { Button } from '@/components/ui/button' import Link from 'next/link' +import { TFunction } from 'next-i18next' /** * Renders the connect section @@ -13,11 +14,7 @@ import Link from 'next/link' * @param {TFunction} t - The translation function * @returns {JSX.Element} The connect section */ -export default function ConnectSection({ - t, -}: { - t: (key: string) => string -}): JSX.Element { +export default function ConnectSection(): JSX.Element { const linkStyle = '*:hover:fill-yellow-400 *:transition-colors' return ( diff --git a/frontend/src/components/static/Static.tsx b/frontend/src/components/static/Static.tsx index 5873ba6f..d57d04d5 100644 --- a/frontend/src/components/static/Static.tsx +++ b/frontend/src/components/static/Static.tsx @@ -58,16 +58,6 @@ export function Head({ ) } -const defaultMetadata: { - height: string - background: string - textColor: string -} = { - height: '400px', - background: '#fff', - textColor: '#000', -} - export function Section({ title, children, @@ -84,27 +74,16 @@ export function Section({ marginTop?: string } }) { - if (!metadata || Object.keys(metadata).length === 0) { - metadata = defaultMetadata - } - - Object.keys(defaultMetadata).forEach((key) => { - if (!metadata[key as keyof typeof metadata]) { - metadata[key as keyof typeof metadata] = - defaultMetadata[key as keyof typeof defaultMetadata] - } - }) - return (
{title && ( diff --git a/frontend/src/components/tags/CommitteeTag.tsx b/frontend/src/components/tags/CommitteeTag.tsx index ed1350c3..d116897b 100644 --- a/frontend/src/components/tags/CommitteeTag.tsx +++ b/frontend/src/components/tags/CommitteeTag.tsx @@ -57,8 +57,9 @@ export const CommitteeTag = forwardRef( ref={ref} > {includeImage && ( - + diff --git a/frontend/src/middleware.ts b/frontend/src/middleware.ts index 394c1735..8368203f 100644 --- a/frontend/src/middleware.ts +++ b/frontend/src/middleware.ts @@ -26,7 +26,7 @@ function handleLanguage(request: NextRequest, cookies: Cookies, serverConsent: S let language; // Blacklisted URLs, which should not be redirected - const blacklistedURLs = ['/_next', '/robots.txt', '/sitemap.xml', '/manifest.webmanifest', '/favicon', '/screenshots', '/apple-icon.png', '/react_devtools_backend_compact.js.map', '/installHook.js.map'] + const blacklistedURLs = ['/_next', '/static', '/robots.txt', '/sitemap.xml', '/manifest.webmanifest', '/favicon', '/screenshots', '/apple-icon.png', '/react_devtools_backend_compact.js.map', '/installHook.js.map'] language = cookies.get(cookieName) if(!language && typeof window !== 'undefined') { language = localStorage.getItem('i18nextLng') } diff --git a/frontend/src/utility/Constants.ts b/frontend/src/utility/Constants.ts index 90798fcb..22f8fa75 100644 --- a/frontend/src/utility/Constants.ts +++ b/frontend/src/utility/Constants.ts @@ -1,6 +1,6 @@ import { Language } from '@/models/Language' -export const API_BASE_URL: string = 'http://localhost:8000/api/v1' +export const API_BASE_URL: string = 'https://api.medieteknik.com/api/v1' export const LANGUAGES: Language = { 'sv': {