Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
cache: 'npm'

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine AS base
FROM node:24-alpine AS base

# Install dependencies only when needed
FROM base AS deps
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Anonymous voting system for National Tsing Hua University Student Association.

### Prerequisites

- Node.js 18.18+
- Node.js 22+ (Docker uses Node.js 24)
- MongoDB 7+
- npm 9+

Expand Down
14 changes: 11 additions & 3 deletions app/vote/certificate/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useState } from "react";
import { useState, useSyncExternalStore } from "react";
import { useRouter } from "next/navigation";
import Header from "@/components/Header";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
Expand All @@ -12,11 +12,19 @@
import { useUser } from "@/hooks";
import { API_CONSTANTS } from "@/lib/constants";

const subscribeToHydration = () => () => {};
const getClientSnapshot = () => true;
const getServerSnapshot = () => false;

export default function CompletionPage() {
const router = useRouter();
const [votingHistory, setVotingHistory] = useState<VotingHistory | null>(
() => loadVotingHistory(),
const isHydrated = useSyncExternalStore(
subscribeToHydration,
getClientSnapshot,
getServerSnapshot,
);
const [savedHistory, setVotingHistory] = useState<VotingHistory | null>(null);

Check warning on line 26 in app/vote/certificate/page.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

useState call is not destructured into value + setter pair

See more on https://sonarcloud.io/project/issues?id=NTHU-SA_Voting-System&issues=AaDoYhB3c7vgePT-GlOr&open=AaDoYhB3c7vgePT-GlOr&pullRequest=58
const votingHistory = savedHistory ?? (isHydrated ? loadVotingHistory() : null);
const [copiedIndex, setCopiedIndex] = useState<number | null>(null);

const { user: userInfo } = useUser();
Expand Down
8 changes: 4 additions & 4 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import Link from "next/link";
import { Heart, Github, Mail, Facebook, Instagram } from "lucide-react";
import { Heart, GitBranch, Mail, Users, Camera } from "lucide-react";

export default function Footer() {
const currentYear = new Date().getFullYear();
Expand Down Expand Up @@ -73,7 +73,7 @@ export default function Footer() {
rel="noopener noreferrer"
className="flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors"
>
<Facebook className="h-4 w-4" />
<Users className="h-4 w-4" />
<span>Facebook</span>
</a>
</li>
Expand All @@ -84,7 +84,7 @@ export default function Footer() {
rel="noopener noreferrer"
className="flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors"
>
<Instagram className="h-4 w-4" />
<Camera className="h-4 w-4" />
<span>Instagram</span>
</a>
</li>
Expand All @@ -95,7 +95,7 @@ export default function Footer() {
rel="noopener noreferrer"
className="flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors"
>
<Github className="h-4 w-4" />
<GitBranch className="h-4 w-4" />
<span>GitHub</span>
</a>
</li>
Expand Down
7 changes: 5 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
},
modulePathIgnorePatterns: ["<rootDir>/.next/"],
testPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/.next/"],
modulePathIgnorePatterns: ["[/\\\\]\\.next[/\\\\]"],

Check warning on line 15 in jest.config.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

`String.raw` should be used to avoid escaping `\`.

See more on https://sonarcloud.io/project/issues?id=NTHU-SA_Voting-System&issues=AaDoYhDwc7vgePT-GlOs&open=AaDoYhDwc7vgePT-GlOs&pullRequest=58
testPathIgnorePatterns: [
"[/\\\\]node_modules[/\\\\]",

Check warning on line 17 in jest.config.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

`String.raw` should be used to avoid escaping `\`.

See more on https://sonarcloud.io/project/issues?id=NTHU-SA_Voting-System&issues=AaDoYhDxc7vgePT-GlOt&open=AaDoYhDxc7vgePT-GlOt&pullRequest=58
"[/\\\\]\\.next[/\\\\]",

Check warning on line 18 in jest.config.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

`String.raw` should be used to avoid escaping `\`.

See more on https://sonarcloud.io/project/issues?id=NTHU-SA_Voting-System&issues=AaDoYhDxc7vgePT-GlOu&open=AaDoYhDxc7vgePT-GlOu&pullRequest=58
],
// Transform ESM modules from bson, mongodb, and mongoose packages
// These packages use ESM exports which need to be transformed for Jest
transformIgnorePatterns: ["/node_modules/(?!(bson|mongodb|mongoose)/)"],
Expand Down
Loading
Loading