Skip to content

Commit e96c6ca

Browse files
authored
Feat: Uni Cooperations (#966)
## What was done? - Updated funnel to ask students about Uni-Cooperations - Updated funnel steps to include new uni-students logic - Added new page "Kooperationen" in Screening-Tool - Added new components used in new screen
1 parent a883012 commit e96c6ca

28 files changed

Lines changed: 754 additions & 45 deletions

package-lock.json

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@
239239
"resetMocks": true
240240
},
241241
"dependencies": {
242+
"@tanstack/react-table": "^8.21.3",
242243
"compression": "^1.7.4",
243244
"express": "^4.18.2",
244245
"react-share": "^5.1.0"

src/components/DataTable.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { ColumnDef, flexRender, getCoreRowModel, getSortedRowModel, SortingState, useReactTable } from '@tanstack/react-table';
2+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/Table';
3+
import { useState } from 'react';
4+
5+
interface DataTableProps<TData, TValue> {
6+
columns: ColumnDef<TData, TValue>[];
7+
data: TData[];
8+
initialSorting?: SortingState;
9+
}
10+
11+
export const DataTable = <TData, TValue>({ columns, data, initialSorting }: DataTableProps<TData, TValue>) => {
12+
const [sorting, setSorting] = useState<SortingState>(initialSorting ?? []);
13+
const table = useReactTable({
14+
data,
15+
columns,
16+
getCoreRowModel: getCoreRowModel(),
17+
onSortingChange: setSorting,
18+
getSortedRowModel: getSortedRowModel(),
19+
state: {
20+
sorting,
21+
},
22+
});
23+
24+
return (
25+
<Table>
26+
<TableHeader>
27+
{table.getHeaderGroups().map((headerGroup) => (
28+
<TableRow key={headerGroup.id}>
29+
{headerGroup.headers.map((header) => {
30+
return (
31+
<TableHead key={header.id}>
32+
{header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}
33+
</TableHead>
34+
);
35+
})}
36+
</TableRow>
37+
))}
38+
</TableHeader>
39+
<TableBody>
40+
{table.getRowModel().rows?.length ? (
41+
table.getRowModel().rows.map((row) => (
42+
<TableRow key={row.id} data-state={row.getIsSelected() && 'selected'}>
43+
{row.getVisibleCells().map((cell) => (
44+
<TableCell key={cell.id}>{flexRender(cell.column.columnDef.cell, cell.getContext())}</TableCell>
45+
))}
46+
</TableRow>
47+
))
48+
) : (
49+
<TableRow>
50+
<TableCell colSpan={columns.length} className="h-24 text-center">
51+
No results.
52+
</TableCell>
53+
</TableRow>
54+
)}
55+
</TableBody>
56+
</Table>
57+
);
58+
};

src/components/SideBarMenu.tsx

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import AppFeedbackModal from '../modals/AppFeedbackModal';
88
import { Button } from './Button';
99
import { Typography } from './Typography';
1010
import { Badge } from './Badge';
11-
import { IconStarHalfFilled } from '@tabler/icons-react';
11+
import { IconStarHalfFilled, IconListCheck } from '@tabler/icons-react';
1212

1313
type Props = {
1414
navItems: NavigationItems;
@@ -39,16 +39,23 @@ const SideBarMenu: React.FC<Props> = ({ navItems, unreadMessagesCount }) => {
3939
return false;
4040
}, [userRoles, userType]);
4141

42-
const hideForStudents = useMemo(() => {
42+
const hideStudentsKnowledgeCenter = useMemo(() => {
4343
if (['screener', 'pupil'].includes(userType)) return true;
4444
return false;
4545
}, [userType]);
4646

47-
const hideForPupils = useMemo(() => {
47+
const hidePupilsKnowledgeCenter = useMemo(() => {
4848
if (['screener', 'student'].includes(userType)) return true;
4949
return false;
5050
}, [userType]);
5151

52+
const hideNavItemForUserType = (route: string) => {
53+
if (userType === 'screener') {
54+
return ['matching', 'chat', 'referral', 'appointments'].includes(route);
55+
}
56+
return false;
57+
};
58+
5259
return (
5360
<div className="hidden md:block min-w-60">
5461
<nav className="flex min-w-60 flex-col h-[calc(100dvh-56px)] fixed pt-9 pb-6 justify-between shadow-lg">
@@ -57,9 +64,10 @@ const SideBarMenu: React.FC<Props> = ({ navItems, unreadMessagesCount }) => {
5764
const disabled =
5865
_disabled || (key === 'matching' && disableMatching) || (key === 'group' && disableGroup) || (key === 'chat' && disableChat);
5966
const isHidden =
60-
(key === 'knowledge-helper' && hideForStudents) ||
61-
(key === 'knowledge-pupil' && hideForPupils) ||
62-
(key === 'lesson' && userType === 'pupil');
67+
(key === 'knowledge-helper' && hideStudentsKnowledgeCenter) ||
68+
(key === 'knowledge-pupil' && hidePupilsKnowledgeCenter) ||
69+
(key === 'lesson' && userType === 'pupil') ||
70+
hideNavItemForUserType(key);
6371
if (isHidden) return null;
6472
return (
6573
<NavLink
@@ -82,6 +90,19 @@ const SideBarMenu: React.FC<Props> = ({ navItems, unreadMessagesCount }) => {
8290
</NavLink>
8391
);
8492
})}
93+
{userType === 'screener' && (
94+
<NavLink
95+
className={({ isActive }) =>
96+
`flex items-center px-2 py-2 rounded-md hover:outline-accent hover:outline
97+
${isActive || rootPath === 'cooperation-helpers' ? 'bg-accent' : ''}`
98+
}
99+
onClick={() => setRootPath && setRootPath('cooperation-helpers')}
100+
to={`/cooperation-helpers`}
101+
>
102+
<IconListCheck />
103+
<Typography className="pl-3 mr-auto font-medium">Kooperationen</Typography>
104+
</NavLink>
105+
)}
85106
</div>
86107
<Button variant="outline" className="w-4/5 self-center" leftIcon={<IconStarHalfFilled size={16} />} onClick={() => setIsOpen(true)}>
87108
{t('appFeedback.giveFeedbackButton')}

src/lang/ar.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,16 @@
641641
},
642642
"specialTeachingExperience": {
643643
"title": "Hast du Kentnisse zu speziellen Förderbedarfen?"
644+
},
645+
"isFromUniCooperation": {
646+
"title": "هل أتيت من تعاون مع جامعة؟"
647+
},
648+
"uniCooperation": {
649+
"title": "ما اسم الجامعة؟"
650+
},
651+
"uniCooperationConfirmation": {
652+
"title": "شكرًا لك!",
653+
"description": "سنراجع معلوماتك ونتواصل معك عبر البريد الإلكتروني بالخطوات التالية. إذا كان لديك أي استفسار، يمكنك التواصل في أي وقت عبر <supportEmail>support@lern-fair.de</supportEmail>."
644654
}
645655
},
646656
"pupil": {

src/lang/de.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,16 @@
638638
"resendConfirmation": "Bestätigung nochmal senden",
639639
"doYouHaveProblems": "Du hast Probleme mit der Anmeldung?"
640640
},
641+
"isFromUniCooperation": {
642+
"title": "Kommst du von einer Uni-Kooperation?"
643+
},
644+
"uniCooperation": {
645+
"title": "Wie heißt die Universität?"
646+
},
647+
"uniCooperationConfirmation": {
648+
"title": "Vielen Dank!",
649+
"description": "Wir prüfen deine Angaben und melden uns per E-Mail mit den nächsten Schritten. Bei Rückfragen kannst du dich jederzeit an <supportEmail>support@lern-fair.de</supportEmail> wenden."
650+
},
641651
"appointmentDetails": {
642652
"title": "Termin erstellt!",
643653
"description": "Es gibt noch ein paar letzte Schritte. Dann können wir richtig gut starten.",

src/lang/en.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,16 @@
641641
},
642642
"specialTeachingExperience": {
643643
"title": "Hast du Kentnisse zu speziellen Förderbedarfen?"
644+
},
645+
"isFromUniCooperation": {
646+
"title": "Are you from a university cooperation?"
647+
},
648+
"uniCooperation": {
649+
"title": "What is the name of the university?"
650+
},
651+
"uniCooperationConfirmation": {
652+
"title": "Thank you!",
653+
"description": "We will review your information and contact you by email with the next steps. If you have any questions, you can contact <supportEmail>support@lern-fair.de</supportEmail> at any time."
644654
}
645655
},
646656
"pupil": {

src/lang/ru.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,16 @@
641641
},
642642
"specialTeachingExperience": {
643643
"title": "Hast du Kentnisse zu speziellen Förderbedarfen?"
644+
},
645+
"isFromUniCooperation": {
646+
"title": "Вы пришли через сотрудничество с университетом?"
647+
},
648+
"uniCooperation": {
649+
"title": "Как называется университет?"
650+
},
651+
"uniCooperationConfirmation": {
652+
"title": "Спасибо!",
653+
"description": "Мы проверим ваши данные и свяжемся с вами по электронной почте с дальнейшими шагами. Если у вас возникнут вопросы, вы можете в любое время написать на <supportEmail>support@lern-fair.de</supportEmail>."
644654
}
645655
},
646656
"pupil": {

src/lang/tr.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,16 @@
641641
},
642642
"specialTeachingExperience": {
643643
"title": "Hast du Kentnisse zu speziellen Förderbedarfen?"
644+
},
645+
"isFromUniCooperation": {
646+
"title": "Bir üniversite iş birliğinden mi geliyorsun?"
647+
},
648+
"uniCooperation": {
649+
"title": "Üniversitenin adı nedir?"
650+
},
651+
"uniCooperationConfirmation": {
652+
"title": "Teşekkür ederiz!",
653+
"description": "Bilgilerini kontrol edeceğiz ve sonraki adımlarla ilgili sana e-posta yoluyla geri dönüş yapacağız. Soruların olursa her zaman <supportEmail>support@lern-fair.de</supportEmail> adresine ulaşabilirsin."
644654
}
645655
},
646656
"pupil": {

src/lang/uk.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,16 @@
641641
},
642642
"specialTeachingExperience": {
643643
"title": "Hast du Kentnisse zu speziellen Förderbedarfen?"
644+
},
645+
"isFromUniCooperation": {
646+
"title": "Ви прийшли через співпрацю з університетом?"
647+
},
648+
"uniCooperation": {
649+
"title": "Як називається університет?"
650+
},
651+
"uniCooperationConfirmation": {
652+
"title": "Дякуємо!",
653+
"description": "Ми перевіримо ваші дані та надішлемо вам електронний лист із наступними кроками. Якщо у вас є запитання, ви завжди можете звернутися за адресою <supportEmail>support@lern-fair.de</supportEmail>."
644654
}
645655
},
646656
"pupil": {

0 commit comments

Comments
 (0)