Skip to content

Repository files navigation

UniSpot Frontend

A React + TypeScript single-page application for UniSpot that lets users discover courses, read/write reviews, browse and purchase study sheets, and manage lease listings with role-based access for students and admins.

Team Members

Name
SITT HMUE EAIN
HSU MYAT NOE MAUNG MAUNG
WIN THUTA AUNG

Tech Stack (Full System)

Layer Technology
Frontend React 19, TypeScript, Vite 7, React Router v7, TanStack Query, Axios, Tailwind CSS, Recharts, React Hook Form, Zod
Backend Next.js 16 (App Router API Routes), TypeScript, Zod
Database MongoDB (Node mongodb driver)
Authentication JWT (jsonwebtoken/jose) + bcryptjs
Infra Docker (frontend Dockerfile + Nginx config in frontend repo)

Features

  • Authentication - Register/login flow with profile bootstrap via /auth/me.
  • Role-Based Access - Route protection for student and admin-side access using ProtectedRoute and RoleRoute.
  • Course Reviews - Browse courses and post/view course and teacher reviews.
  • Study Sheet Marketplace - Public listing, student-owned study sheet CRUD, and purchase flow.
  • PromptPay QR Payment Support - Study sheet purchases generate EMV payload + QR from VITE_PROMPTPAY_PHONE.
  • Lease Marketplace - Public lease listing browsing and student lease listing management.
  • Dashboard + Wallet - Shared dashboard landing and student wallet flow.
  • Profile + My Reviews - Authenticated profile management and student review history.
  • Moderation Workspace - Admin-side moderation pages for study sheets, leases, teacher reviews, and teacher suggestions.
  • Admin Tools - Payments, withdrawals, and report moderation routes.

Admin Side Screenshots

Admin Login

Screenshot 2569-02-27 at 22 27 31

Dashboard

Screenshot 2569-02-27 at 22 30 54

Study Sheets

Screenshot 2569-02-27 at 22 28 00

Leases Marketplace

Screenshot 2569-02-27 at 22 28 12

Course Reviews (Course List)

Screenshot 2569-02-27 at 22 28 20

Course Reviews (Detail)

Screenshot 2569-02-27 at 22 28 39

Study Sheet Moderation

Screenshot 2569-02-27 at 22 29 13

Teacher Review Moderation

Screenshot 2569-02-27 at 22 29 22

Lease Moderation

Screenshot 2569-02-27 at 22 29 30

Payments

Screenshot 2569-02-27 at 22 29 36

Withdrawals

Screenshot 2569-02-27 at 22 29 50

Report Moderation

Screenshot 2569-02-27 at 22 30 11

Profile

Screenshot 2569-02-27 at 22 30 25

Student Side Screenshots

Register

Screenshot 2569-02-27 at 23 43 12

Dashboard

Screenshot 2569-02-27 at 23 00 32

Study Sheets Marketplace

Screenshot 2569-02-27 at 23 00 43

Study Sheet Purchase Modal

Screenshot 2569-02-27 at 23 44 07

Leases Marketplace

Screenshot 2569-02-27 at 23 44 15

Course Reviews (Course List)

Screenshot 2569-02-27 at 23 44 31

Course Reviews (Course Review Tab)

Screenshot 2569-02-27 at 23 44 42

Course Reviews (Teacher Review Tab)

Screenshot 2569-02-27 at 23 44 52

My Study Sheets (My Uploads)

Screenshot 2569-02-27 at 23 45 10

My Study Sheets (Purchased)

Screenshot 2569-02-27 at 23 45 18

Create New Study Sheet

Screenshot 2569-02-27 at 23 45 46

My Lease Listings

Screenshot 2569-02-27 at 23 49 18

Create New Lease Listing

Screenshot 2569-02-27 at 23 45 56

Wallet

Screenshot 2569-02-27 at 23 46 04

My Profile

Screenshot 2569-02-27 at 23 46 15

Project Structure

Unispot_frontend/
├── docs/
│   └── screenshots/
│       └── admin/
├── public/
├── src/
│   ├── api/
│   │   ├── http.ts                        # Axios instance + auth interceptors
│   │   ├── auth.api.ts                    # Auth endpoints
│   │   ├── courses.api.ts                 # Course endpoints
│   │   ├── reviews.api.ts                 # Course review endpoints
│   │   ├── teacherReviews.api.ts          # Teacher review endpoints
│   │   ├── studySheets.api.ts             # Study sheet endpoints
│   │   ├── leaseListings.api.ts           # Lease listing endpoints
│   │   ├── leases.api.ts                  # Lease marketplace endpoints
│   │   ├── moderation.api.ts              # Study sheet moderation endpoints
│   │   ├── reviewModeration.api.ts        # Review moderation endpoints
│   │   ├── teacherReviewModeration.api.ts # Teacher review moderation endpoints
│   │   ├── teacherSuggestions.api.ts      # Teacher suggestion endpoints
│   │   ├── leaseModeration.api.ts         # Lease moderation endpoints
│   │   ├── payments.api.ts                # Payment/admin endpoints
│   │   ├── withdrawals.api.ts             # Admin withdrawal endpoints
│   │   ├── reports.api.ts                 # Admin report moderation endpoints
│   │   ├── profile.api.ts                 # Profile endpoints
│   │   ├── wallet.api.ts                  # Wallet endpoints
│   │   ├── dashboard.api.ts               # Dashboard endpoints
│   │   └── purchases.api.ts               # Study sheet purchase endpoints
│   ├── auth/
│   │   ├── AuthProvider.tsx
│   │   └── useAuth.ts
│   ├── components/                        # Shared UI (Button, Modal, Table, Alert, etc.)
│   ├── layouts/
│   │   └── AppLayout.tsx
│   ├── pages/
│   │   ├── admin/
│   │   ├── dashboard/
│   │   ├── moderation/
│   │   ├── courses/
│   │   ├── leases/
│   │   ├── profile/
│   │   ├── reviews/
│   │   └── wallet/
│   ├── routes/
│   │   ├── ProtectedRoute.tsx
│   │   └── RoleRoute.tsx
│   ├── utils/
│   │   ├── promptpay.ts
│   │   ├── format.ts
│   │   └── money.ts
│   ├── App.tsx
│   └── main.tsx
├── package.json
└── README.md

Route Access Matrix

Area Routes Access
Public /, /login, /register, /courses, /courses/:courseId/reviews, /study-sheets, /lease-listings, /leases Everyone
Authenticated /dashboard, /profile, /student/*, /student/study-sheets/*, /student/lease-listings/* Any logged-in user
Student only /study-sheets/create, /leases/mine, /wallet, /reviews/mine STUDENT
Moderation /moderation/*, /moderation/study-sheets, /moderation/lease-listings, /moderation/teacher-reviews, /moderation/teacher-suggestions Admin-side moderation access
Admin /admin, /admin/payments, /admin/withdrawals, /admin/reports ADMIN

Getting Started

Prerequisites

  • Node.js 18+
  • npm 9+
  • UniSpot backend service running and reachable

Install and Run

npm install
npm run dev

Default local URL: http://localhost:5173

Production Build

npm run build
npm run preview

Lint

npm run lint

Environment Variables

Create .env in project root:

VITE_API_BASE_URL=http://localhost:3000
VITE_PROMPTPAY_PHONE=0936022762
VITE_ADMIN_EMAIL=admin@example.com
VITE_ADMIN_PASSWORD=your_admin_password
Variable Required Description
VITE_API_BASE_URL Yes Base URL for backend API calls (src/api/http.ts).
VITE_PROMPTPAY_PHONE Recommended PromptPay phone/ID used to generate purchase QR payload on study sheets page.
VITE_ADMIN_EMAIL Optional Enables one-click admin login button on login page.
VITE_ADMIN_PASSWORD Optional Password paired with VITE_ADMIN_EMAIL for quick admin login.

Notes

  • Access token is stored in localStorage key access_token.
  • Request interceptor injects Authorization: Bearer <token>.
  • On 401, the client clears token and redirects to /login.
  • Post-auth landing redirects to /dashboard for all roles in current frontend logic.
  • Across frontend and backend code, moderation endpoints and pages are grouped under admin-side workflows.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages