Skip to content

Commit 82c7159

Browse files
committed
Change website link icon; Get edition through event service; Add shine
1 parent c090027 commit 82c7159

File tree

12 files changed

+106
-21
lines changed

12 files changed

+106
-21
lines changed

src/app/(authenticated)/companies/[id]/page.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { SessionTile } from "@/components/session";
1313
import EventDayButton from "@/components/EventDayButton";
1414
import { Scan } from "lucide-react";
1515
import Link from "next/link";
16-
import { SocialNetwork } from "@/components/SocialNetwork";
1716
import BlankPageWithMessage from "@/components/BlankPageMessage";
1817
import ConnectionTile from "@/components/user/ConnectionTile";
18+
import { LinkIcon } from "lucide-react";
1919

2020
interface CompanyParams {
2121
id: string;
@@ -48,12 +48,12 @@ export default async function Company({ params }: { params: CompanyParams }) {
4848

4949
const companyConnections = await CompanyService.getConnections(
5050
session.cannonToken,
51-
companyID,
51+
companyID
5252
);
5353

5454
return (
5555
<div className="container mx-auto">
56-
<div className="flex flex-col items-center gap-y-2 p-4 text-center">
56+
<div className="flex flex-col items-center gap-y-3 p-4 text-center">
5757
<h2 className="text-2xl font-bold">{company.name}</h2>
5858
<Image
5959
className="w-40 h-40 object-contain"
@@ -63,11 +63,17 @@ export default async function Company({ params }: { params: CompanyParams }) {
6363
alt={`${company.name} logo`}
6464
/>
6565
{hereToday && (
66-
<span className="bg-sinfo-primary text-white rounded-md px-3 py-1 text-lg font-bold uppercase">
66+
<span className="bg-sinfo-secondary text-white rounded-md px-3 py-1 text-lg font-bold uppercase">
6767
Here Today
6868
</span>
6969
)}
70-
{company.site && <SocialNetwork type="website" text={company.site} />}
70+
{company.site && (
71+
<Link href={company.site} target="blank">
72+
<div className="bg-sinfo-primary text-white font-bold p-2 rounded-full">
73+
<LinkIcon size={20} />
74+
</div>
75+
</Link>
76+
)}
7177
</div>
7278
{/* Members section */}
7379
{user && isMember(user.role) && (

src/app/(authenticated)/home/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { UserService } from "@/services/UserService";
1515
import { isCompany, isToday } from "@/utils/utils";
1616
import UserSignOut from "@/components/UserSignOut";
1717
import { SPIN_WHEEL_MAXIMUM } from "@/constants";
18+
import { EventService } from "@/services/EventService";
1819

1920
const N_SESSION_TILES = 3;
2021
const N_COMPANY_TILES = 6;
@@ -25,6 +26,7 @@ export default async function Home() {
2526
const user = await UserService.getMe(session.cannonToken);
2627
if (!user) return <UserSignOut />;
2728

29+
const event = await EventService.getLatest();
2830
const eventSessions = await SessionService.getSessions();
2931
const companies = await CompanyService.getCompanies();
3032
const speakers = await SpeakerService.getSpeakers();
@@ -48,7 +50,7 @@ export default async function Home() {
4850
: [];
4951

5052
const spinWheelData = user.signatures?.find(
51-
(s) => s.edition === process.env.EVENT_EDITION && isToday(s.day)
53+
(s) => s.edition === event?.id && isToday(s.day)
5254
);
5355
const showSpinWheelSection =
5456
!isCompany(user.role) && !spinWheelData?.redeemed;

src/app/(authenticated)/spin/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ProgressBar from "@/components/ProgressBar";
66
import UserSignOut from "@/components/UserSignOut";
77
import { SPIN_WHEEL_MAXIMUM } from "@/constants";
88
import { CompanyService } from "@/services/CompanyService";
9+
import { EventService } from "@/services/EventService";
910
import { UserService } from "@/services/UserService";
1011
import { isCompany, isToday } from "@/utils/utils";
1112
import { getServerSession } from "next-auth";
@@ -21,8 +22,9 @@ export default async function Spin() {
2122
);
2223
}
2324

25+
const event = await EventService.getLatest();
2426
const spinWheelData = user.signatures?.find(
25-
(s) => s.edition === process.env.EVENT_EDITION && isToday(s.day)
27+
(s) => s.edition === event?.id && isToday(s.day)
2628
);
2729

2830
if (spinWheelData?.redeemed) {

src/app/(authenticated)/users/[id]/buttons/ValidateSpinButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default function ValidateSpinButton({
1111
cannonToken,
1212
user,
1313
otherUser,
14+
edition,
1415
}: ProfileButtonProps) {
1516
const router = useRouter();
1617

@@ -23,7 +24,7 @@ export default function ValidateSpinButton({
2324
}
2425

2526
const spinWheelData = otherUser.signatures?.find(
26-
(s) => s.edition === process.env.EVENT_EDITION && isToday(s.day)
27+
(s) => s.edition === edition && isToday(s.day)
2728
);
2829

2930
const isEligible =

src/app/(authenticated)/users/[id]/buttons/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface ProfileButtonProps {
77
user: User;
88
otherUser: User;
99
connections: Connection[];
10+
edition?: string;
1011
}
1112

1213
export default function ProfileButtons(buttonProps: ProfileButtonProps) {

src/app/(authenticated)/users/[id]/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import UserSignOut from "@/components/UserSignOut";
1313
import BlankPageWithMessage from "@/components/BlankPageMessage";
1414
import ProfileButtons from "./buttons";
1515
import Notes from "@/components/user/Notes";
16+
import { EventService } from "@/services/EventService";
1617

1718
interface UserProfileParams {
1819
id: string;
@@ -34,9 +35,11 @@ export default async function UserProfile({
3435
return <BlankPageWithMessage message="User not found!" />;
3536
}
3637

38+
const event = await EventService.getLatest();
39+
3740
const achievements = await AchievementService.getAchievements();
3841
const userAchievements = achievements?.filter((a) =>
39-
a.users?.includes(userProfile.id),
42+
a.users?.includes(userProfile.id)
4043
);
4144

4245
const connections = await UserService.getConnections(session.cannonToken);
@@ -48,7 +51,7 @@ export default async function UserProfile({
4851
await UserService.updateConnection(
4952
session.cannonToken,
5053
userProfile.id,
51-
notes,
54+
notes
5255
);
5356
}
5457

@@ -61,6 +64,7 @@ export default async function UserProfile({
6164
user={user}
6265
otherUser={userProfile}
6366
connections={connections ?? []}
67+
edition={event?.id ?? ``}
6468
/>
6569

6670
{/* Notes */}

src/components/BottomNavbar/QRCodeButton.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ export default function QRCodeButton() {
1818
return <></>;
1919

2020
return (
21-
<Link
22-
href="/qr"
23-
className="absolute -top-20 right-4 p-4 rounded-full bg-sinfo-primary"
24-
>
25-
<QrCode size={32} />
21+
<Link href="/qr">
22+
<div className="absolute -top-20 right-4">
23+
<div className="p-4 rounded-full bg-sinfo-primary relative overflow-hidden">
24+
<QrCode size={32} />
25+
<div className="shine-effect" />
26+
</div>
27+
</div>
2628
</Link>
2729
);
2830
}

src/mocks/data/event.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const MOCK_EVENT: SINFOEvent = {
2-
id: "31",
3-
name: "SINFO 31",
2+
id: "mock_event_id",
3+
name: "SINFO XX",
44
kind: "Main Event",
55
date: "2024-04-15T00:00:00Z",
66
duration: "1970-01-05T00:00:00.000Z",

src/mocks/data/user.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { MOCK_ACHIEVEMENTS } from "./achievement";
2+
import { MOCK_EVENT } from "./event";
23

34
export const MOCK_USER: User = {
45
id: "mock_user_id",
@@ -17,7 +18,7 @@ export const MOCK_USER: User = {
1718
updated: "2024-11-16T23:02:19.167Z",
1819
signatures: [
1920
{
20-
edition: process.env.EVENT_EDITION as string,
21+
edition: MOCK_EVENT.id,
2122
day: new Date().toISOString(),
2223
redeemed: false,
2324
signatures: MOCK_ACHIEVEMENTS.filter(
@@ -35,7 +36,7 @@ export const MOCK_USER: User = {
3536
};
3637

3738
export const MOCK_OTHER_USER: User = {
38-
id: "mock_other_user_id",
39+
id: "other_user_id_1",
3940
name: "Zark Muckerberg",
4041
title: "CEO @ Meta",
4142
img: "https://s.yimg.com/ny/api/res/1.2/GLHIAcBCGu77FLFmPc8ObA--/YXBwaWQ9aGlnaGxhbmRlcjt3PTY0MDtoPTY0MA--/https://media.zenfs.com/en/nbc_today_217/1f5be50c0b4beae5c873e1c78bd0fd36",
@@ -46,11 +47,11 @@ export const MOCK_OTHER_USER: User = {
4647
updated: "2024-11-11T23:02:19.167Z",
4748
signatures: [
4849
{
49-
edition: process.env.EVENT_EDITION as string,
50+
edition: MOCK_EVENT.id,
5051
day: new Date().toISOString(),
5152
redeemed: false,
5253
signatures: MOCK_ACHIEVEMENTS.filter(
53-
(a) => a.kind === "stand" && a.users?.includes("mock_other_user_id")
54+
(a) => a.kind === "stand" && a.users?.includes("other_user_id_1")
5455
).map(
5556
(a, idx) =>
5657
({
@@ -61,5 +62,6 @@ export const MOCK_OTHER_USER: User = {
6162
},
6263
],
6364
};
65+
6466
export const MOCK_USER_QR_CODE: string =
6567
"sinfo://eyJhbGciOiJIUzI1NiIsInR5cCI6IlNJTkZPIn0.eyJzdWIiOiJ1c2VyIiwidXNlciI6eyJpZCI6Im1vY2tfdXNlcl9pZCIsIm5hbWUiOiJKb2huIERvZSIsImltZyI6Imh0dHBzOi8vbWVkaWEubGljZG4uY29tL2Rtcy9pbWFnZS92Mi9ENTYwM0FRSHY2THNkaVVnMWt3L3Byb2ZpbGUtZGlzcGxheXBob3RvLXNocmlua180MDBfNDAwL3Byb2ZpbGUtZGlzcGxheXBob3RvLXNocmlua180MDBfNDAwLzAvMTY5NTE2NzM0NDU3Nj9lPTE3Mzc1OTA0MDAmdj1iZXRhJnQ9VTg4LXFkc3lmQkpfMklqQTA4dFBQTkNwQUFLWERROU5ic0ktcnFvZWlObyIsInJvbGUiOiJ1c2VyIn0sImV4cCI6IjQxMDI0NDQ4MDAifQ.U84gaw-yp7b3Aakt4lYC_REwvDGwvbL_Nn28RqbqyAA";

src/mocks/handlers.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ import {
1717
const BACKEND_URL = process.env.CANNON_URL;
1818

1919
export const handlers = [
20+
// get latest sinfo event
21+
http.get(`${BACKEND_URL}/event/latest`, () => {
22+
return HttpResponse.json(MOCK_EVENT);
23+
}),
2024
// get cannon_token for the user
2125
http.post(`${BACKEND_URL}/auth/*`, () => {
2226
return HttpResponse.json({
@@ -31,6 +35,10 @@ export const handlers = [
3135
http.put(`${BACKEND_URL}/users/me`, () => {
3236
return new Response(null, { status: 200 });
3337
}),
38+
// get logged in user connections
39+
http.get(`${BACKEND_URL}/users/me/connections`, () => {
40+
return HttpResponse.json([]);
41+
}),
3442
// get user QR-Code
3543
http.get(`${BACKEND_URL}/users/qr-code`, () => {
3644
return HttpResponse.json({ data: MOCK_USER_QR_CODE });

0 commit comments

Comments
 (0)