├── app ├── 401 │ └── page.tsx ├── api │ └── auth │ │ └── [...nextauth] │ │ └── route.ts ├── favicon.ico ├── auth │ ├── layout.tsx │ └── signin │ │ ├── error │ │ └── page.tsx │ │ └── page.tsx ├── (home) │ ├── layout.tsx │ ├── my-account │ │ ├── layout.tsx │ │ └── page.tsx │ ├── locations │ │ └── page.tsx │ ├── fine │ │ └── result │ │ │ └── page.tsx │ ├── activities │ │ └── page.tsx │ ├── search │ │ └── page.tsx │ └── page.tsx ├── (admin) │ └── admin │ │ ├── layout.tsx │ │ ├── categories │ │ ├── columns.tsx │ │ ├── page.tsx │ │ └── categories-table.tsx │ │ ├── users │ │ ├── page.tsx │ │ ├── columns.tsx │ │ └── users-table.tsx │ │ ├── activities │ │ ├── page.tsx │ │ ├── columns.tsx │ │ └── activities-table.tsx │ │ ├── fines │ │ ├── page.tsx │ │ ├── columns.tsx │ │ └── fines-table.tsx │ │ ├── page.tsx │ │ └── (cataloge) │ │ ├── catalog-table.tsx │ │ └── columns.tsx ├── layout.tsx ├── kiosk-sim │ └── page.tsx ├── profile │ ├── page.tsx │ └── profile-form.tsx └── globals.css ├── public ├── library_logo.png ├── vercel.svg ├── window.svg ├── file.svg ├── globe.svg └── next.svg ├── prisma ├── migrations │ ├── migration_lock.toml │ └── 20241223230538_added_categories_table │ │ └── migration.sql └── sql │ └── getReservationRankForBook.sql ├── postcss.config.mjs ├── lib ├── stripe.ts ├── prisma.ts ├── firebase.ts └── utils.ts ├── middleware.ts ├── components ├── ui │ ├── skeleton.tsx │ ├── textarea.tsx │ ├── label.tsx │ ├── input.tsx │ ├── separator.tsx │ ├── toaster.tsx │ ├── checkbox.tsx │ ├── tooltip.tsx │ ├── popover.tsx │ ├── tabs.tsx │ ├── button.tsx │ ├── calendar.tsx │ ├── table.tsx │ ├── dialog.tsx │ ├── sheet.tsx │ ├── form.tsx │ ├── alert-dialog.tsx │ ├── toast.tsx │ ├── navigation-menu.tsx │ └── command.tsx ├── logo.tsx ├── signin-button.tsx ├── signout-button.tsx ├── back-button.tsx ├── pay-fine-button.tsx ├── add-to-staffpick-button.tsx ├── cancel-hold-button.tsx ├── add-book-button.tsx ├── add-user-button.tsx ├── remove-from-staffpick-button.tsx ├── add-category-button.tsx ├── add-activity-button.tsx ├── place-hold-button.tsx ├── data-table-input-filter.tsx ├── rating.tsx ├── footer.tsx ├── hold-button.tsx ├── staff-pick-button.tsx ├── header.tsx ├── confirmation-dialog.tsx ├── time-select.tsx ├── search-bar.tsx ├── comment-box.tsx ├── data-table-view-options.tsx ├── date-select.tsx ├── comment-card.tsx ├── admin-sidebar.tsx ├── data-table-actions.tsx ├── user-button.tsx ├── on-hold.tsx ├── activity-date-select.tsx ├── data-table-column-header.tsx ├── borrowing-history.tsx ├── fines.tsx ├── navbar.tsx ├── data-table-pagination.tsx ├── add-category-dialog.tsx ├── member-sidebar.tsx ├── checkout.tsx └── data-table.tsx ├── next.config.ts ├── eslint.config.mjs ├── components.json ├── hooks ├── use-mobile.tsx └── use-toast.ts ├── tsconfig.json ├── .gitignore ├── README.md ├── auth.ts ├── tailwind.config.ts └── package.json /app/api/auth/[...nextauth]/route.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grepsoft/thelibrary/HEAD/app/favicon.ico -------------------------------------------------------------------------------- /public/library_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grepsoft/thelibrary/HEAD/public/library_logo.png -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /prisma/migrations/migration_lock.toml: -------------------------------------------------------------------------------- 1 | # Please do not edit this file manually 2 | # It should be added in your version-control system (e.g., Git) 3 | provider = "mysql" -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /lib/stripe.ts: -------------------------------------------------------------------------------- 1 | import 'server-only' 2 | 3 | import Stripe from 'stripe' 4 | 5 | export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, { 6 | apiVersion: '2024-12-18.acacia' 7 | }) -------------------------------------------------------------------------------- /middleware.ts: -------------------------------------------------------------------------------- 1 | export { auth as middleware } from '@/auth' 2 | 3 | //////////////////////////// 4 | // Please watch the video 5 | //////////////////////////// -------------------------------------------------------------------------------- /prisma/migrations/20241223230538_added_categories_table/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE `book_categories` ( 3 | `category_id` INTEGER NOT NULL AUTO_INCREMENT, 4 | `category_name` VARCHAR(255) NOT NULL, 5 | 6 | PRIMARY KEY (`category_id`) 7 | ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 8 | -------------------------------------------------------------------------------- /lib/prisma.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from "@prisma/client" 2 | 3 | const globalForPrisma = global as unknown as { prisma: PrismaClient } 4 | 5 | export const prisma = globalForPrisma.prisma || new PrismaClient({ 6 | log: ['query', 'info', 'warn', 'error'] 7 | }) 8 | 9 | if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma -------------------------------------------------------------------------------- /components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils" 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ) 13 | } 14 | 15 | export { Skeleton } 16 | -------------------------------------------------------------------------------- /app/auth/layout.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | function AuthLayout({ 4 | children 5 | }: { children: React.ReactNode}) { 6 | return ( 7 |
8 | {children} 9 |
10 | ) 11 | } 12 | 13 | export default AuthLayout -------------------------------------------------------------------------------- /next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = { 4 | images: { 5 | formats: ['image/avif', 'image/webp'], 6 | remotePatterns: [ 7 | { 8 | protocol: 'https', 9 | hostname: 'firebasestorage.googleapis.com' 10 | } 11 | ] 12 | } 13 | }; 14 | 15 | export default nextConfig; 16 | -------------------------------------------------------------------------------- /public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /prisma/sql/getReservationRankForBook.sql: -------------------------------------------------------------------------------- 1 | -- @param {Int} $1:book_id The book that is on hold 2 | -- @param {Int} $2:user_id The user id for which we want to get the rank 3 | 4 | SELECT user_rank.queue_number FROM 5 | ( 6 | SELECT r.user_id, 7 | ROW_NUMBER() OVER (ORDER BY r.reservation_date) AS queue_number 8 | FROM reservations r 9 | WHERE book_id = ? 10 | ) as user_rank 11 | WHERE user_rank.user_id = ? 12 | -------------------------------------------------------------------------------- /app/(home)/layout.tsx: -------------------------------------------------------------------------------- 1 | import Footer from '@/components/footer' 2 | import Header from '@/components/header' 3 | import Navbar from '@/components/navbar' 4 | import React from 'react' 5 | 6 | function HomeLayout({ children }: { 7 | children: React.ReactNode 8 | }) { 9 | return ( 10 | <> 11 |
12 | 13 | {children} 14 |