Skip to content

Commit 1a91c34

Browse files
authored
Added level for presentations (#35)
* updated staffs * added level badge for presentations * added profile logo * fixed bug * fixed responsive otp input * fixed sign up redirection
1 parent 9dab6db commit 1a91c34

9 files changed

Lines changed: 108 additions & 57 deletions

File tree

apps/game_craft/components/features/workshops/WorkshopCard.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,16 @@ export function WorkshopCard({
276276
}}
277277
count={t(`workshop.type.${presentation.type}`)}
278278
/>
279+
<Badge
280+
style={{
281+
backgroundColor: "transparent",
282+
color: token.colorInfo,
283+
border: `1px solid ${token.colorInfo}`,
284+
borderRadius: "4px",
285+
padding: "0 8px",
286+
}}
287+
count={t(`workshop.level.${presentation.level}`)}
288+
/>
279289
</Flex>
280290
</Flex>
281291

apps/game_craft/config/staffs.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ export function useStaffs(): StaffTeam[] {
5858
linkedinUrl: "https://www.linkedin.com/in/mo-ja-akbari/",
5959
telegramUrl: "",
6060
},
61+
{
62+
imageUrl: "/images/2025/staffs/MoeinEnayati.png",
63+
name: "معین عنایتی",
64+
role: "توسعه دهنده بک اند و دوآپس",
65+
telegramUrl: "https://t.me/moein_enayati",
66+
linkedinUrl: "https://www.linkedin.com/in/moein-enayati",
67+
githubUrl: "https://github.com/moeinEN",
68+
},
6169
{
6270
imageUrl: "/images/2025/staffs/AlirezaNikooei.jpg",
6371
name: "علیرضا نیکوئی",

apps/game_craft/messages/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@
294294
"course": "Course",
295295
"talk": "Talk",
296296
"workshop": "Workshop"
297+
},
298+
"level": {
299+
"beginner": "Beginner",
300+
"intermediate": "Intermediate",
301+
"advanced": "Advanced"
297302
}
298303
},
299304
"common": {

apps/game_craft/messages/fa.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@
294294
"course": "دوره",
295295
"talk": "سخنرانی",
296296
"workshop": "کارگاه"
297+
},
298+
"level": {
299+
"beginner": "مبتدی",
300+
"intermediate": "متوسط",
301+
"advanced": "پیشرفته"
297302
}
298303
},
299304
"common": {

apps/ssc/app/(auth)/register/steps/registerStepThird.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ export const RegisterStepThird = () => {
1313
ثبت نام شما با موفقیت انجام شد
1414
</p>
1515
<div className="w-full flex flex-col items-center gap-2.5 px-8 py-4">
16-
<Link href={{ href: "/login", query: params.toString() }}>
16+
<Link
17+
href={{
18+
pathname: "/login",
19+
query: Object.fromEntries(params.entries()),
20+
}}
21+
>
1722
<Button
1823
className="w-full"
1924
variant={ButtonVariant.PRIMARY}

apps/ssc/app/(auth)/register/steps/registerStepTwo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const RegisterStepTwo = ({ nextStep, email: mail }: Props) => {
7979
value={otp}
8080
onChange={setOtp}
8181
numInputs={OTP_LENGTH}
82-
containerStyle="flex flex-row-reverse gap-4 justify-center px-24"
82+
containerStyle="flex flex-row-reverse gap-4 justify-center px-4 sm:px-24"
8383
inputStyle="border-b-2 w-48 gradient-border !w-full outline-none text-4xl font-bold"
8484
shouldAutoFocus
8585
inputType="text"
Lines changed: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,76 @@
11
"use client";
22

3-
import {Button, ButtonSize, ButtonVariant} from "@ssc/ui";
4-
import {signOut, useSession} from "next-auth/react";
3+
import { Button, ButtonSize, ButtonVariant } from "@ssc/ui";
4+
import { signOut, useSession } from "next-auth/react";
55
import Link from "next/link";
6-
import {useEffect} from "react";
7-
import {userSelector} from "~/core/store/Auth/user.selector";
8-
import {fetchUserData} from "~/core/store/Auth/user.thunk";
9-
import {useAppDispatch, useAppSelector} from "~/core/store/store";
10-
import {AiOutlineLoading} from "react-icons/ai";
6+
import { useEffect, useState } from "react";
7+
import { userSelector } from "~/core/store/Auth/user.selector";
8+
import { fetchUserData } from "~/core/store/Auth/user.thunk";
9+
import { useAppDispatch, useAppSelector } from "~/core/store/store";
10+
import { AiOutlineLoading } from "react-icons/ai";
11+
import { HiUser } from "react-icons/hi";
1112

1213
const AuthData = () => {
13-
const dispatch = useAppDispatch();
14-
const session = useSession();
15-
const userData = useAppSelector(userSelector);
14+
const dispatch = useAppDispatch();
15+
const session = useSession();
16+
const userData = useAppSelector(userSelector);
17+
const [logoutVisible, setLogoutVisible] = useState(false);
1618

17-
useEffect(() => {
18-
if (session.status === "authenticated") {
19-
dispatch(fetchUserData());
20-
}
21-
}, [dispatch, session]);
19+
useEffect(() => {
20+
if (session.status === "authenticated") {
21+
dispatch(fetchUserData());
22+
}
23+
}, [dispatch, session]);
2224

23-
const handleLogout = () => {
24-
signOut();
25-
};
25+
const handleLogout = () => {
26+
signOut();
27+
};
2628

27-
if (session.status === "unauthenticated") {
28-
return (
29-
<>
30-
<Link href="/login">
31-
<Button
32-
className="min-h-9 min-w-16"
33-
variant={ButtonVariant.TEXT}
34-
size={ButtonSize.SMALL}
35-
label="ورود"
36-
/>
37-
</Link>
38-
<Link href="/register">
39-
<Button
40-
className="min-h-9 min-w-16"
41-
variant={ButtonVariant.PRIMARY}
42-
size={ButtonSize.SMALL}
43-
label="ثبت نام"
44-
/>
45-
</Link>
46-
</>
47-
);
48-
} else {
49-
if (!userData.loggedIn || session.status === "loading") {
50-
return <AiOutlineLoading className="animate-spin"/>;
51-
}
52-
return (
53-
<>
54-
<p>{userData.first_name + " " + userData.last_name}</p>
55-
<Button
56-
className="min-h-9 min-w-16 bg-red-700"
57-
size={ButtonSize.SMALL}
58-
label="خروج از حساب"
59-
onClick={handleLogout}
60-
/>
61-
</>
62-
);
29+
if (session.status === "unauthenticated") {
30+
return (
31+
<div className="flex items-center gap-2">
32+
<Link href="/login">
33+
<Button
34+
className="min-h-9 min-w-16"
35+
variant={ButtonVariant.TEXT}
36+
size={ButtonSize.SMALL}
37+
label="ورود"
38+
/>
39+
</Link>
40+
<Link href="/register">
41+
<Button
42+
className="min-h-9 min-w-16"
43+
variant={ButtonVariant.PRIMARY}
44+
size={ButtonSize.SMALL}
45+
label="ثبت نام"
46+
/>
47+
</Link>
48+
</div>
49+
);
50+
} else {
51+
if (!userData.loggedIn || session.status === "loading") {
52+
return <AiOutlineLoading className="animate-spin" />;
6353
}
54+
return (
55+
<div
56+
className="flex items-center gap-2 cursor-pointer"
57+
onClick={() => setLogoutVisible(!logoutVisible)}
58+
>
59+
{logoutVisible && (
60+
<Button
61+
className="min-h-9 min-w-16 bg-red-700"
62+
size={ButtonSize.SMALL}
63+
label="خروج"
64+
onClick={handleLogout}
65+
/>
66+
)}
67+
<p>{userData.first_name + " " + userData.last_name}</p>
68+
<div className="w-10 content-center justify-items-center rounded-full aspect-square bg-gradient text-white">
69+
<HiUser size={24} />
70+
</div>
71+
</div>
72+
);
73+
}
6474
};
6575

6676
export default AuthData;

apps/ssc/app/(landings)/components/Navbar/Navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const Navbar = async () => {
3131
))}
3232
</div>
3333
</div>
34-
<div className="hidden md:flex items-center gap-2">
34+
<div className="hidden md:block">
3535
<AuthData />
3636
</div>
3737
<HamburgerMenu />

packages/core/src/types/api/Presentation/presentation.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ export enum PresentationType {
1515
WORKSHOP = "workshop",
1616
}
1717

18+
export enum PresentationLevel {
19+
BEGINNER = "beginner",
20+
INTERMEDIATE = "intermediate",
21+
ADVANCED = "advanced",
22+
}
23+
1824
export interface Presentation {
1925
id: PresentationId;
2026
event: number;
@@ -35,6 +41,7 @@ export interface Presentation {
3541
is_active: boolean;
3642
poster: string;
3743
remaining_capacity: number;
44+
level: PresentationLevel;
3845
}
3946

4047
export type PresentationOverview = Pick<
@@ -57,6 +64,7 @@ export type PresentationOverview = Pick<
5764
| "is_active"
5865
| "poster"
5966
| "remaining_capacity"
67+
| "level"
6068
>;
6169

6270
export type PresentationsList = {

0 commit comments

Comments
 (0)