Spaces:
Running
Running
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitignore +45 -0
- .modified +0 -0
- Dockerfile +10 -0
- README.md +0 -2
- apphosting.yaml +7 -0
- components.json +21 -0
- next.config.ts +47 -0
- package-lock.json +0 -0
- package.json +69 -0
- postcss.config.mjs +8 -0
- src/ai/dev.ts +4 -0
- src/ai/flows/skills-extraction.ts +56 -0
- src/ai/genkit.ts +7 -0
- src/app/actions.ts +56 -0
- src/app/globals.css +69 -0
- src/app/layout.tsx +40 -0
- src/app/page.tsx +23 -0
- src/components/charts/sentiment-chart.tsx +64 -0
- src/components/icons.tsx +23 -0
- src/components/landing/about.tsx +38 -0
- src/components/landing/contact.tsx +93 -0
- src/components/landing/footer.tsx +14 -0
- src/components/landing/header.tsx +71 -0
- src/components/landing/hero.tsx +35 -0
- src/components/landing/projects.tsx +110 -0
- src/components/landing/skills.tsx +58 -0
- src/components/ui/accordion.tsx +58 -0
- src/components/ui/alert-dialog.tsx +141 -0
- src/components/ui/alert.tsx +59 -0
- src/components/ui/avatar.tsx +50 -0
- src/components/ui/badge.tsx +36 -0
- src/components/ui/button.tsx +56 -0
- src/components/ui/calendar.tsx +70 -0
- src/components/ui/card.tsx +79 -0
- src/components/ui/carousel.tsx +262 -0
- src/components/ui/chart.tsx +365 -0
- src/components/ui/checkbox.tsx +30 -0
- src/components/ui/collapsible.tsx +11 -0
- src/components/ui/dialog.tsx +122 -0
- src/components/ui/dropdown-menu.tsx +200 -0
- src/components/ui/form.tsx +178 -0
- src/components/ui/input.tsx +22 -0
- src/components/ui/label.tsx +26 -0
- src/components/ui/menubar.tsx +256 -0
- src/components/ui/popover.tsx +31 -0
- src/components/ui/progress.tsx +28 -0
- src/components/ui/radio-group.tsx +44 -0
- src/components/ui/scroll-area.tsx +48 -0
- src/components/ui/select.tsx +160 -0
- src/components/ui/separator.tsx +31 -0
.gitignore
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
| 2 |
+
|
| 3 |
+
# dependencies
|
| 4 |
+
/node_modules
|
| 5 |
+
/.pnp
|
| 6 |
+
.pnp.*
|
| 7 |
+
.yarn/*
|
| 8 |
+
!.yarn/patches
|
| 9 |
+
!.yarn/plugins
|
| 10 |
+
!.yarn/releases
|
| 11 |
+
!.yarn/versions
|
| 12 |
+
|
| 13 |
+
# testing
|
| 14 |
+
/coverage
|
| 15 |
+
|
| 16 |
+
# next.js
|
| 17 |
+
/.next/
|
| 18 |
+
/out/
|
| 19 |
+
|
| 20 |
+
# production
|
| 21 |
+
/build
|
| 22 |
+
|
| 23 |
+
# misc
|
| 24 |
+
.DS_Store
|
| 25 |
+
*.pem
|
| 26 |
+
|
| 27 |
+
# debug
|
| 28 |
+
npm-debug.log*
|
| 29 |
+
yarn-debug.log*
|
| 30 |
+
yarn-error.log*
|
| 31 |
+
.pnpm-debug.log*
|
| 32 |
+
|
| 33 |
+
# vercel
|
| 34 |
+
.vercel
|
| 35 |
+
|
| 36 |
+
# typescript
|
| 37 |
+
*.tsbuildinfo
|
| 38 |
+
next-env.d.ts
|
| 39 |
+
|
| 40 |
+
.genkit/*
|
| 41 |
+
.env*
|
| 42 |
+
|
| 43 |
+
# firebase
|
| 44 |
+
firebase-debug.log
|
| 45 |
+
firestore-debug.log
|
.modified
ADDED
|
File without changes
|
Dockerfile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:22-alpine
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY package*.json ./
|
| 4 |
+
RUN npm install
|
| 5 |
+
COPY . .
|
| 6 |
+
EXPOSE 7860
|
| 7 |
+
RUN npm run build
|
| 8 |
+
RUN chown -R node:node /app
|
| 9 |
+
USER node
|
| 10 |
+
CMD ["npm", "run", "start"]
|
README.md
CHANGED
|
@@ -7,5 +7,3 @@ sdk: docker
|
|
| 7 |
pinned: false
|
| 8 |
short_description: my work details
|
| 9 |
---
|
| 10 |
-
|
| 11 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 7 |
pinned: false
|
| 8 |
short_description: my work details
|
| 9 |
---
|
|
|
|
|
|
apphosting.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Settings to manage and configure a Firebase App Hosting backend.
|
| 2 |
+
# https://firebase.google.com/docs/app-hosting/configure
|
| 3 |
+
|
| 4 |
+
runConfig:
|
| 5 |
+
# Increase this value if you'd like to automatically spin up
|
| 6 |
+
# more instances in response to increased traffic.
|
| 7 |
+
maxInstances: 1
|
components.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://ui.shadcn.com/schema.json",
|
| 3 |
+
"style": "default",
|
| 4 |
+
"rsc": true,
|
| 5 |
+
"tsx": true,
|
| 6 |
+
"tailwind": {
|
| 7 |
+
"config": "tailwind.config.ts",
|
| 8 |
+
"css": "src/app/globals.css",
|
| 9 |
+
"baseColor": "neutral",
|
| 10 |
+
"cssVariables": true,
|
| 11 |
+
"prefix": ""
|
| 12 |
+
},
|
| 13 |
+
"aliases": {
|
| 14 |
+
"components": "@/components",
|
| 15 |
+
"utils": "@/lib/utils",
|
| 16 |
+
"ui": "@/components/ui",
|
| 17 |
+
"lib": "@/lib",
|
| 18 |
+
"hooks": "@/hooks"
|
| 19 |
+
},
|
| 20 |
+
"iconLibrary": "lucide"
|
| 21 |
+
}
|
next.config.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type {NextConfig} from 'next';
|
| 2 |
+
|
| 3 |
+
const nextConfig: NextConfig = {
|
| 4 |
+
/* config options here */
|
| 5 |
+
typescript: {
|
| 6 |
+
ignoreBuildErrors: true,
|
| 7 |
+
},
|
| 8 |
+
eslint: {
|
| 9 |
+
ignoreDuringBuilds: true,
|
| 10 |
+
},
|
| 11 |
+
images: {
|
| 12 |
+
remotePatterns: [
|
| 13 |
+
{
|
| 14 |
+
protocol: 'https',
|
| 15 |
+
hostname: 'placehold.co',
|
| 16 |
+
port: '',
|
| 17 |
+
pathname: '/**',
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
protocol: 'https',
|
| 21 |
+
hostname: 'images.unsplash.com',
|
| 22 |
+
port: '',
|
| 23 |
+
pathname: '/**',
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
protocol: 'https',
|
| 27 |
+
hostname: 'picsum.photos',
|
| 28 |
+
port: '',
|
| 29 |
+
pathname: '/**',
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
protocol: 'https',
|
| 33 |
+
hostname: 'avatars.githubusercontent.com',
|
| 34 |
+
port: '',
|
| 35 |
+
pathname: '/**',
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
protocol: 'https',
|
| 39 |
+
hostname: 'raw.githubusercontent.com',
|
| 40 |
+
port: '',
|
| 41 |
+
pathname: '/**',
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
},
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
export default nextConfig;
|
package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "nextn",
|
| 3 |
+
"version": "0.1.0",
|
| 4 |
+
"private": true,
|
| 5 |
+
"scripts": {
|
| 6 |
+
"dev": "next dev --turbopack -p 9002",
|
| 7 |
+
"genkit:dev": "genkit start -- tsx src/ai/dev.ts",
|
| 8 |
+
"genkit:watch": "genkit start -- tsx --watch src/ai/dev.ts",
|
| 9 |
+
"build": "next build",
|
| 10 |
+
"start": "next start -p 7860",
|
| 11 |
+
"lint": "next lint",
|
| 12 |
+
"typecheck": "tsc --noEmit"
|
| 13 |
+
},
|
| 14 |
+
"dependencies": {
|
| 15 |
+
"@genkit-ai/googleai": "^1.14.1",
|
| 16 |
+
"@genkit-ai/next": "^1.14.1",
|
| 17 |
+
"@hookform/resolvers": "^4.1.3",
|
| 18 |
+
"@radix-ui/react-accordion": "^1.2.3",
|
| 19 |
+
"@radix-ui/react-alert-dialog": "^1.1.6",
|
| 20 |
+
"@radix-ui/react-avatar": "^1.1.3",
|
| 21 |
+
"@radix-ui/react-checkbox": "^1.1.4",
|
| 22 |
+
"@radix-ui/react-collapsible": "^1.1.11",
|
| 23 |
+
"@radix-ui/react-dialog": "^1.1.6",
|
| 24 |
+
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
| 25 |
+
"@radix-ui/react-label": "^2.1.2",
|
| 26 |
+
"@radix-ui/react-menubar": "^1.1.6",
|
| 27 |
+
"@radix-ui/react-popover": "^1.1.6",
|
| 28 |
+
"@radix-ui/react-progress": "^1.1.2",
|
| 29 |
+
"@radix-ui/react-radio-group": "^1.2.3",
|
| 30 |
+
"@radix-ui/react-scroll-area": "^1.2.3",
|
| 31 |
+
"@radix-ui/react-select": "^2.1.6",
|
| 32 |
+
"@radix-ui/react-separator": "^1.1.2",
|
| 33 |
+
"@radix-ui/react-slider": "^1.2.3",
|
| 34 |
+
"@radix-ui/react-slot": "^1.2.3",
|
| 35 |
+
"@radix-ui/react-switch": "^1.1.3",
|
| 36 |
+
"@radix-ui/react-tabs": "^1.1.3",
|
| 37 |
+
"@radix-ui/react-toast": "^1.2.6",
|
| 38 |
+
"@radix-ui/react-tooltip": "^1.1.8",
|
| 39 |
+
"class-variance-authority": "^0.7.1",
|
| 40 |
+
"clsx": "^2.1.1",
|
| 41 |
+
"date-fns": "^3.6.0",
|
| 42 |
+
"dotenv": "^16.5.0",
|
| 43 |
+
"embla-carousel-react": "^8.6.0",
|
| 44 |
+
"firebase": "^11.9.1",
|
| 45 |
+
"genkit": "^1.14.1",
|
| 46 |
+
"lucide-react": "^0.475.0",
|
| 47 |
+
"next": "15.3.3",
|
| 48 |
+
"nodemailer": "^6.9.14",
|
| 49 |
+
"patch-package": "^8.0.0",
|
| 50 |
+
"react": "^18.3.1",
|
| 51 |
+
"react-day-picker": "^8.10.1",
|
| 52 |
+
"react-dom": "^18.3.1",
|
| 53 |
+
"react-hook-form": "^7.54.2",
|
| 54 |
+
"recharts": "^2.15.1",
|
| 55 |
+
"tailwind-merge": "^3.0.1",
|
| 56 |
+
"tailwindcss-animate": "^1.0.7",
|
| 57 |
+
"zod": "^3.24.2"
|
| 58 |
+
},
|
| 59 |
+
"devDependencies": {
|
| 60 |
+
"@types/node": "^20",
|
| 61 |
+
"@types/nodemailer": "^6.4.15",
|
| 62 |
+
"@types/react": "^18",
|
| 63 |
+
"@types/react-dom": "^18",
|
| 64 |
+
"genkit-cli": "^1.14.1",
|
| 65 |
+
"postcss": "^8",
|
| 66 |
+
"tailwindcss": "^3.4.1",
|
| 67 |
+
"typescript": "^5"
|
| 68 |
+
}
|
| 69 |
+
}
|
postcss.config.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** @type {import('postcss-load-config').Config} */
|
| 2 |
+
const config = {
|
| 3 |
+
plugins: {
|
| 4 |
+
tailwindcss: {},
|
| 5 |
+
},
|
| 6 |
+
};
|
| 7 |
+
|
| 8 |
+
export default config;
|
src/ai/dev.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { config } from 'dotenv';
|
| 2 |
+
config();
|
| 3 |
+
|
| 4 |
+
import '@/ai/flows/skills-extraction.ts';
|
src/ai/flows/skills-extraction.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use server';
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* @fileOverview This file defines a Genkit flow for extracting data science skills from project descriptions.
|
| 5 |
+
*
|
| 6 |
+
* It includes:
|
| 7 |
+
* - `extractSkills`: An async function to initiate the skill extraction process.
|
| 8 |
+
* - `SkillsExtractionInput`: The input type for the `extractSkills` function, containing an array of project descriptions.
|
| 9 |
+
* - `SkillsExtractionOutput`: The output type for the `extractSkills` function, listing the extracted skills.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
import {ai} from '@/ai/genkit';
|
| 13 |
+
import {z} from 'genkit';
|
| 14 |
+
|
| 15 |
+
const SkillsExtractionInputSchema = z.object({
|
| 16 |
+
projectDescriptions: z
|
| 17 |
+
.array(z.string())
|
| 18 |
+
.describe('An array of project descriptions.'),
|
| 19 |
+
});
|
| 20 |
+
export type SkillsExtractionInput = z.infer<typeof SkillsExtractionInputSchema>;
|
| 21 |
+
|
| 22 |
+
const SkillsExtractionOutputSchema = z.object({
|
| 23 |
+
skills: z
|
| 24 |
+
.array(z.string())
|
| 25 |
+
.describe('A list of the unique data science skills extracted from the project descriptions.'),
|
| 26 |
+
});
|
| 27 |
+
export type SkillsExtractionOutput = z.infer<typeof SkillsExtractionOutputSchema>;
|
| 28 |
+
|
| 29 |
+
export async function extractSkills(input: SkillsExtractionInput): Promise<SkillsExtractionOutput> {
|
| 30 |
+
return skillsExtractionFlow(input);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
const skillsExtractionPrompt = ai.definePrompt({
|
| 34 |
+
name: 'skillsExtractionPrompt',
|
| 35 |
+
input: {schema: SkillsExtractionInputSchema},
|
| 36 |
+
output: {schema: SkillsExtractionOutputSchema},
|
| 37 |
+
prompt: `You are an expert data science skill identifier.
|
| 38 |
+
|
| 39 |
+
Given the following project descriptions, identify the key data science skills that are demonstrated. Provide the skills as a list of strings.
|
| 40 |
+
|
| 41 |
+
Project Descriptions:
|
| 42 |
+
{{#each projectDescriptions}}- {{{this}}}
|
| 43 |
+
{{/each}}`,
|
| 44 |
+
});
|
| 45 |
+
|
| 46 |
+
const skillsExtractionFlow = ai.defineFlow(
|
| 47 |
+
{
|
| 48 |
+
name: 'skillsExtractionFlow',
|
| 49 |
+
inputSchema: SkillsExtractionInputSchema,
|
| 50 |
+
outputSchema: SkillsExtractionOutputSchema,
|
| 51 |
+
},
|
| 52 |
+
async input => {
|
| 53 |
+
const {output} = await skillsExtractionPrompt(input);
|
| 54 |
+
return output!;
|
| 55 |
+
}
|
| 56 |
+
);
|
src/ai/genkit.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {genkit} from 'genkit';
|
| 2 |
+
import {googleAI} from '@genkit-ai/googleai';
|
| 3 |
+
|
| 4 |
+
export const ai = genkit({
|
| 5 |
+
plugins: [googleAI()],
|
| 6 |
+
model: 'googleai/gemini-2.5-flash',
|
| 7 |
+
});
|
src/app/actions.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use server";
|
| 2 |
+
|
| 3 |
+
import { z } from "zod";
|
| 4 |
+
import nodemailer from "nodemailer";
|
| 5 |
+
|
| 6 |
+
const contactSchema = z.object({
|
| 7 |
+
name: z.string().min(2, "Name must be at least 2 characters."),
|
| 8 |
+
email: z.string().email("Invalid email address."),
|
| 9 |
+
message: z.string().min(10, "Message must be at least 10 characters."),
|
| 10 |
+
});
|
| 11 |
+
|
| 12 |
+
export async function submitContactForm(prevState: any, formData: FormData) {
|
| 13 |
+
const validatedFields = contactSchema.safeParse({
|
| 14 |
+
name: formData.get("name"),
|
| 15 |
+
email: formData.get("email"),
|
| 16 |
+
message: formData.get("message"),
|
| 17 |
+
});
|
| 18 |
+
|
| 19 |
+
if (!validatedFields.success) {
|
| 20 |
+
return {
|
| 21 |
+
errors: validatedFields.error.flatten().fieldErrors,
|
| 22 |
+
message: "Please correct the errors below.",
|
| 23 |
+
};
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
const { name, email, message } = validatedFields.data;
|
| 27 |
+
|
| 28 |
+
// Note: Using an App Password is highly recommended for Gmail.
|
| 29 |
+
const transporter = nodemailer.createTransport({
|
| 30 |
+
host: "smtp.gmail.com",
|
| 31 |
+
port: 465,
|
| 32 |
+
secure: true, // true for 465, false for other ports
|
| 33 |
+
auth: {
|
| 34 |
+
user: process.env.EMAIL_USER, // Your Gmail address
|
| 35 |
+
pass: process.env.EMAIL_PASS, // Your Gmail App Password
|
| 36 |
+
},
|
| 37 |
+
});
|
| 38 |
+
|
| 39 |
+
const mailOptions = {
|
| 40 |
+
from: process.env.EMAIL_USER,
|
| 41 |
+
to: "slimshadow.work@gmail.com",
|
| 42 |
+
subject: `Contact Form Submission from ${name}`,
|
| 43 |
+
text: `You have a new message from ${name} (${email}):\n\n${message}`,
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
+
try {
|
| 47 |
+
await transporter.sendMail(mailOptions);
|
| 48 |
+
return { message: "Thank you for your message! I'll get back to you soon." };
|
| 49 |
+
} catch (error) {
|
| 50 |
+
console.error("Error sending email:", error);
|
| 51 |
+
return {
|
| 52 |
+
errors: {},
|
| 53 |
+
message: "Sorry, there was an error sending your message. Please try again later.",
|
| 54 |
+
};
|
| 55 |
+
}
|
| 56 |
+
}
|
src/app/globals.css
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@tailwind base;
|
| 2 |
+
@tailwind components;
|
| 3 |
+
@tailwind utilities;
|
| 4 |
+
|
| 5 |
+
@layer base {
|
| 6 |
+
:root {
|
| 7 |
+
--background: 240 67% 97%;
|
| 8 |
+
--foreground: 240 10% 3.9%;
|
| 9 |
+
--card: 240 67% 98.5%;
|
| 10 |
+
--card-foreground: 240 10% 3.9%;
|
| 11 |
+
--popover: 240 67% 97%;
|
| 12 |
+
--popover-foreground: 240 10% 3.9%;
|
| 13 |
+
--primary: 275 100% 26%;
|
| 14 |
+
--primary-foreground: 0 0% 98%;
|
| 15 |
+
--secondary: 240 30% 93%;
|
| 16 |
+
--secondary-foreground: 240 10% 3.9%;
|
| 17 |
+
--muted: 240 20% 92%;
|
| 18 |
+
--muted-foreground: 240 5% 45.1%;
|
| 19 |
+
--accent: 43 74% 49%;
|
| 20 |
+
--accent-foreground: 240 10% 3.9%;
|
| 21 |
+
--destructive: 0 84.2% 60.2%;
|
| 22 |
+
--destructive-foreground: 0 0% 98%;
|
| 23 |
+
--border: 240 10% 89.8%;
|
| 24 |
+
--input: 240 10% 89.8%;
|
| 25 |
+
--ring: 275 100% 26%;
|
| 26 |
+
--radius: 0.8rem;
|
| 27 |
+
--chart-1: 12 76% 61%;
|
| 28 |
+
--chart-2: 173 58% 39%;
|
| 29 |
+
--chart-3: 197 37% 24%;
|
| 30 |
+
--chart-4: 43 74% 66%;
|
| 31 |
+
--chart-5: 27 87% 67%;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.dark {
|
| 35 |
+
--background: 240 10% 3.9%;
|
| 36 |
+
--foreground: 0 0% 98%;
|
| 37 |
+
--card: 240 10% 5.9%;
|
| 38 |
+
--card-foreground: 0 0% 98%;
|
| 39 |
+
--popover: 240 10% 3.9%;
|
| 40 |
+
--popover-foreground: 0 0% 98%;
|
| 41 |
+
--primary: 43 74% 49%;
|
| 42 |
+
--primary-foreground: 240 10% 3.9%;
|
| 43 |
+
--secondary: 240 5% 14.9%;
|
| 44 |
+
--secondary-foreground: 0 0% 98%;
|
| 45 |
+
--muted: 240 5% 14.9%;
|
| 46 |
+
--muted-foreground: 0 0% 63.9%;
|
| 47 |
+
--accent: 275 100% 45%;
|
| 48 |
+
--accent-foreground: 0 0% 98%;
|
| 49 |
+
--destructive: 0 62.8% 30.6%;
|
| 50 |
+
--destructive-foreground: 0 0% 98%;
|
| 51 |
+
--border: 240 5% 14.9%;
|
| 52 |
+
--input: 240 5% 14.9%;
|
| 53 |
+
--ring: 43 74% 49%;
|
| 54 |
+
--chart-1: 220 70% 50%;
|
| 55 |
+
--chart-2: 160 60% 45%;
|
| 56 |
+
--chart-3: 30 80% 55%;
|
| 57 |
+
--chart-4: 280 65% 60%;
|
| 58 |
+
--chart-5: 340 75% 55%;
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
@layer base {
|
| 63 |
+
* {
|
| 64 |
+
@apply border-border;
|
| 65 |
+
}
|
| 66 |
+
body {
|
| 67 |
+
@apply bg-background text-foreground;
|
| 68 |
+
}
|
| 69 |
+
}
|
src/app/layout.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Metadata } from "next";
|
| 2 |
+
import "./globals.css";
|
| 3 |
+
import { Toaster } from "@/components/ui/toaster";
|
| 4 |
+
import { cn } from "@/lib/utils";
|
| 5 |
+
|
| 6 |
+
export const metadata: Metadata = {
|
| 7 |
+
title: "Portfolio",
|
| 8 |
+
description: "Portfolio of an aspiring data scientist.",
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
export default function RootLayout({
|
| 12 |
+
children,
|
| 13 |
+
}: Readonly<{
|
| 14 |
+
children: React.ReactNode;
|
| 15 |
+
}>) {
|
| 16 |
+
return (
|
| 17 |
+
<html lang="en" className="!scroll-smooth">
|
| 18 |
+
<head>
|
| 19 |
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
| 20 |
+
<link
|
| 21 |
+
rel="preconnect"
|
| 22 |
+
href="https://fonts.gstatic.com"
|
| 23 |
+
crossOrigin="anonymous"
|
| 24 |
+
/>
|
| 25 |
+
<link
|
| 26 |
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Space+Grotesk:wght@400;500;700&display=swap"
|
| 27 |
+
rel="stylesheet"
|
| 28 |
+
/>
|
| 29 |
+
</head>
|
| 30 |
+
<body
|
| 31 |
+
className={cn(
|
| 32 |
+
"font-body antialiased bg-background min-h-screen flex flex-col"
|
| 33 |
+
)}
|
| 34 |
+
>
|
| 35 |
+
{children}
|
| 36 |
+
<Toaster />
|
| 37 |
+
</body>
|
| 38 |
+
</html>
|
| 39 |
+
);
|
| 40 |
+
}
|
src/app/page.tsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Header } from "@/components/landing/header";
|
| 2 |
+
import { Hero } from "@/components/landing/hero";
|
| 3 |
+
import { About } from "@/components/landing/about";
|
| 4 |
+
import { Projects } from "@/components/landing/projects";
|
| 5 |
+
import { Skills } from "@/components/landing/skills";
|
| 6 |
+
import { Contact } from "@/components/landing/contact";
|
| 7 |
+
import { Footer } from "@/components/landing/footer";
|
| 8 |
+
|
| 9 |
+
export default function Home() {
|
| 10 |
+
return (
|
| 11 |
+
<>
|
| 12 |
+
<Header />
|
| 13 |
+
<main className="flex-grow">
|
| 14 |
+
<Hero />
|
| 15 |
+
<About />
|
| 16 |
+
<Projects />
|
| 17 |
+
<Skills />
|
| 18 |
+
<Contact />
|
| 19 |
+
</main>
|
| 20 |
+
<Footer />
|
| 21 |
+
</>
|
| 22 |
+
);
|
| 23 |
+
}
|
src/components/charts/sentiment-chart.tsx
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import { Pie, PieChart, ResponsiveContainer } from "recharts";
|
| 4 |
+
import {
|
| 5 |
+
ChartContainer,
|
| 6 |
+
ChartTooltip,
|
| 7 |
+
ChartTooltipContent,
|
| 8 |
+
ChartLegend,
|
| 9 |
+
ChartLegendContent,
|
| 10 |
+
} from "@/components/ui/chart";
|
| 11 |
+
|
| 12 |
+
const chartData = [
|
| 13 |
+
{ sentiment: "Positive", value: 45, fill: "hsl(var(--chart-2))" },
|
| 14 |
+
{ sentiment: "Negative", value: 15, fill: "hsl(var(--chart-5))" },
|
| 15 |
+
{ sentiment: "Neutral", value: 40, fill: "hsl(var(--muted-foreground))" },
|
| 16 |
+
];
|
| 17 |
+
|
| 18 |
+
const chartConfig = {
|
| 19 |
+
value: {
|
| 20 |
+
label: "Percentage",
|
| 21 |
+
},
|
| 22 |
+
positive: {
|
| 23 |
+
label: "Positive",
|
| 24 |
+
color: "hsl(var(--chart-2))",
|
| 25 |
+
},
|
| 26 |
+
negative: {
|
| 27 |
+
label: "Negative",
|
| 28 |
+
color: "hsl(var(--chart-5))",
|
| 29 |
+
},
|
| 30 |
+
neutral: {
|
| 31 |
+
label: "Neutral",
|
| 32 |
+
color: "hsl(var(--muted-foreground))",
|
| 33 |
+
},
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
export function SentimentChart() {
|
| 37 |
+
return (
|
| 38 |
+
<ChartContainer
|
| 39 |
+
config={chartConfig}
|
| 40 |
+
className="mx-auto aspect-square max-h-[250px]"
|
| 41 |
+
>
|
| 42 |
+
<ResponsiveContainer>
|
| 43 |
+
<PieChart>
|
| 44 |
+
<ChartTooltip
|
| 45 |
+
cursor={false}
|
| 46 |
+
content={<ChartTooltipContent hideLabel />}
|
| 47 |
+
/>
|
| 48 |
+
<Pie
|
| 49 |
+
data={chartData}
|
| 50 |
+
dataKey="value"
|
| 51 |
+
nameKey="sentiment"
|
| 52 |
+
innerRadius={60}
|
| 53 |
+
strokeWidth={5}
|
| 54 |
+
aria-label="Sentiment distribution pie chart"
|
| 55 |
+
/>
|
| 56 |
+
<ChartLegend
|
| 57 |
+
content={<ChartLegendContent nameKey="sentiment" />}
|
| 58 |
+
className="-translate-y-[2rem] flex-wrap gap-2 [&>*]:basis-1/4 [&>*]:justify-center"
|
| 59 |
+
/>
|
| 60 |
+
</PieChart>
|
| 61 |
+
</ResponsiveContainer>
|
| 62 |
+
</ChartContainer>
|
| 63 |
+
);
|
| 64 |
+
}
|
src/components/icons.tsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { cn } from "@/lib/utils";
|
| 2 |
+
|
| 3 |
+
export const PortfolioLogo = ({ className, ...props }: React.SVGProps<SVGSVGElement>) => (
|
| 4 |
+
<svg
|
| 5 |
+
xmlns="http://www.w3.org/2000/svg"
|
| 6 |
+
width="24"
|
| 7 |
+
height="24"
|
| 8 |
+
viewBox="0 0 24 24"
|
| 9 |
+
fill="none"
|
| 10 |
+
stroke="currentColor"
|
| 11 |
+
strokeWidth="2"
|
| 12 |
+
strokeLinecap="round"
|
| 13 |
+
strokeLinejoin="round"
|
| 14 |
+
className={cn("lucide lucide-focus", className)}
|
| 15 |
+
{...props}
|
| 16 |
+
>
|
| 17 |
+
<circle cx="12" cy="12" r="3" />
|
| 18 |
+
<path d="M3 7V5a2 2 0 0 1 2-2h2" />
|
| 19 |
+
<path d="M17 3h2a2 2 0 0 1 2 2v2" />
|
| 20 |
+
<path d="M21 17v2a2 2 0 0 1-2 2h-2" />
|
| 21 |
+
<path d="M7 21H5a2 2 0 0 1-2-2v-2" />
|
| 22 |
+
</svg>
|
| 23 |
+
);
|
src/components/landing/about.tsx
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Image from "next/image";
|
| 2 |
+
import { PlaceHolderImages } from "@/lib/placeholder-images";
|
| 3 |
+
import { aboutMe } from "@/lib/data";
|
| 4 |
+
|
| 5 |
+
export function About() {
|
| 6 |
+
const profileImage = PlaceHolderImages.find(
|
| 7 |
+
(img) => img.id === "profile-picture"
|
| 8 |
+
);
|
| 9 |
+
|
| 10 |
+
return (
|
| 11 |
+
<section id="about" className="w-full py-12 md:py-24 lg:py-32 bg-background">
|
| 12 |
+
<div className="container px-4 md:px-6">
|
| 13 |
+
<div className="grid gap-10 lg:grid-cols-2 lg:gap-16 items-center">
|
| 14 |
+
<div className="space-y-4">
|
| 15 |
+
<h2 className="text-3xl font-headline font-bold tracking-tighter sm:text-4xl md:text-5xl text-primary">
|
| 16 |
+
About Me
|
| 17 |
+
</h2>
|
| 18 |
+
<p className="max-w-[600px] text-muted-foreground md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed">
|
| 19 |
+
{aboutMe.bio}
|
| 20 |
+
</p>
|
| 21 |
+
</div>
|
| 22 |
+
<div className="flex justify-center">
|
| 23 |
+
{profileImage && (
|
| 24 |
+
<Image
|
| 25 |
+
src={profileImage.imageUrl}
|
| 26 |
+
alt={profileImage.description}
|
| 27 |
+
data-ai-hint={profileImage.imageHint}
|
| 28 |
+
width={432}
|
| 29 |
+
height={592}
|
| 30 |
+
className="rounded-lg object-contain shadow-lg border-4 border-accent"
|
| 31 |
+
/>
|
| 32 |
+
)}
|
| 33 |
+
</div>
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
</section>
|
| 37 |
+
);
|
| 38 |
+
}
|
src/components/landing/contact.tsx
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import { useActionState } from "react";
|
| 4 |
+
import { useFormStatus } from "react-dom";
|
| 5 |
+
import { useEffect } from "react";
|
| 6 |
+
import { useToast } from "@/hooks/use-toast";
|
| 7 |
+
import { submitContactForm } from "@/app/actions";
|
| 8 |
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
|
| 9 |
+
import { Label } from "@/components/ui/label";
|
| 10 |
+
import { Input } from "@/components/ui/input";
|
| 11 |
+
import { Textarea } from "@/components/ui/textarea";
|
| 12 |
+
import { Button } from "@/components/ui/button";
|
| 13 |
+
import { Mail } from "lucide-react";
|
| 14 |
+
|
| 15 |
+
function SubmitButton() {
|
| 16 |
+
const { pending } = useFormStatus();
|
| 17 |
+
return (
|
| 18 |
+
<Button type="submit" disabled={pending}>
|
| 19 |
+
{pending ? "Sending..." : "Send Message"}
|
| 20 |
+
</Button>
|
| 21 |
+
);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
export function Contact() {
|
| 25 |
+
const { toast } = useToast();
|
| 26 |
+
const initialState = { message: null, errors: {} };
|
| 27 |
+
const [state, dispatch] = useActionState(submitContactForm, initialState);
|
| 28 |
+
|
| 29 |
+
useEffect(() => {
|
| 30 |
+
if (state.message) {
|
| 31 |
+
if (state.errors) {
|
| 32 |
+
toast({
|
| 33 |
+
title: "Error",
|
| 34 |
+
description: state.message,
|
| 35 |
+
variant: "destructive",
|
| 36 |
+
});
|
| 37 |
+
} else {
|
| 38 |
+
toast({
|
| 39 |
+
title: "Success!",
|
| 40 |
+
description: state.message,
|
| 41 |
+
});
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}, [state, toast]);
|
| 45 |
+
|
| 46 |
+
return (
|
| 47 |
+
<section id="contact" className="w-full py-12 md:py-24 lg:py-32 bg-secondary">
|
| 48 |
+
<div className="container px-4 md:px-6">
|
| 49 |
+
<Card className="max-w-xl mx-auto">
|
| 50 |
+
<CardHeader className="text-center">
|
| 51 |
+
<Mail className="mx-auto h-12 w-12 text-primary mb-4" />
|
| 52 |
+
<CardTitle className="font-headline text-3xl">Get in Touch</CardTitle>
|
| 53 |
+
<CardDescription>
|
| 54 |
+
Have a question or want to work together? Send me a message.
|
| 55 |
+
</CardDescription>
|
| 56 |
+
</CardHeader>
|
| 57 |
+
<CardContent>
|
| 58 |
+
<form action={dispatch} className="space-y-4">
|
| 59 |
+
<div className="space-y-2">
|
| 60 |
+
<Label htmlFor="name">Name</Label>
|
| 61 |
+
<Input id="name" name="name" placeholder="Your Name" />
|
| 62 |
+
{state.errors?.name && (
|
| 63 |
+
<p className="text-sm font-medium text-destructive">
|
| 64 |
+
{state.errors.name[0]}
|
| 65 |
+
</p>
|
| 66 |
+
)}
|
| 67 |
+
</div>
|
| 68 |
+
<div className="space-y-2">
|
| 69 |
+
<Label htmlFor="email">Email</Label>
|
| 70 |
+
<Input id="email" name="email" type="email" placeholder="your@email.com" />
|
| 71 |
+
{state.errors?.email && (
|
| 72 |
+
<p className="text-sm font-medium text-destructive">
|
| 73 |
+
{state.errors.email[0]}
|
| 74 |
+
</p>
|
| 75 |
+
)}
|
| 76 |
+
</div>
|
| 77 |
+
<div className="space-y-2">
|
| 78 |
+
<Label htmlFor="message">Message</Label>
|
| 79 |
+
<Textarea id="message" name="message" placeholder="Your message..." />
|
| 80 |
+
{state.errors?.message && (
|
| 81 |
+
<p className="text-sm font-medium text-destructive">
|
| 82 |
+
{state.errors.message[0]}
|
| 83 |
+
</p>
|
| 84 |
+
)}
|
| 85 |
+
</div>
|
| 86 |
+
<SubmitButton />
|
| 87 |
+
</form>
|
| 88 |
+
</CardContent>
|
| 89 |
+
</Card>
|
| 90 |
+
</div>
|
| 91 |
+
</section>
|
| 92 |
+
);
|
| 93 |
+
}
|
src/components/landing/footer.tsx
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { aboutMe } from "@/lib/data";
|
| 2 |
+
|
| 3 |
+
export function Footer() {
|
| 4 |
+
const currentYear = new Date().getFullYear();
|
| 5 |
+
return (
|
| 6 |
+
<footer className="w-full bg-background border-t">
|
| 7 |
+
<div className="container flex items-center justify-center py-6">
|
| 8 |
+
<p className="text-sm text-muted-foreground">
|
| 9 |
+
© {currentYear} {aboutMe.name}. All rights reserved.
|
| 10 |
+
</p>
|
| 11 |
+
</div>
|
| 12 |
+
</footer>
|
| 13 |
+
);
|
| 14 |
+
}
|
src/components/landing/header.tsx
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import React, { useState, useEffect } from "react";
|
| 4 |
+
import Link from "next/link";
|
| 5 |
+
import { Github } from "lucide-react";
|
| 6 |
+
import { Button } from "@/components/ui/button";
|
| 7 |
+
import { PortfolioLogo } from "@/components/icons";
|
| 8 |
+
import { cn } from "@/lib/utils";
|
| 9 |
+
|
| 10 |
+
const navItems = [
|
| 11 |
+
{ name: "About", href: "#about" },
|
| 12 |
+
{ name: "Projects", href: "#projects" },
|
| 13 |
+
{ name: "Skills", href: "#skills" },
|
| 14 |
+
{ name: "Contact", href: "#contact" },
|
| 15 |
+
];
|
| 16 |
+
|
| 17 |
+
export function Header() {
|
| 18 |
+
const [isScrolled, setIsScrolled] = useState(false);
|
| 19 |
+
|
| 20 |
+
useEffect(() => {
|
| 21 |
+
const handleScroll = () => {
|
| 22 |
+
setIsScrolled(window.scrollY > 10);
|
| 23 |
+
};
|
| 24 |
+
window.addEventListener("scroll", handleScroll);
|
| 25 |
+
return () => {
|
| 26 |
+
window.removeEventListener("scroll", handleScroll);
|
| 27 |
+
};
|
| 28 |
+
}, []);
|
| 29 |
+
|
| 30 |
+
return (
|
| 31 |
+
<header
|
| 32 |
+
className={cn(
|
| 33 |
+
"sticky top-0 z-50 w-full transition-all duration-300",
|
| 34 |
+
isScrolled
|
| 35 |
+
? "bg-background/80 backdrop-blur-sm border-b"
|
| 36 |
+
: "bg-background"
|
| 37 |
+
)}
|
| 38 |
+
>
|
| 39 |
+
<div className="container flex h-16 items-center">
|
| 40 |
+
<Link href="/" className="mr-6 flex items-center space-x-2">
|
| 41 |
+
<PortfolioLogo className="h-6 w-6 text-primary" />
|
| 42 |
+
<span className="font-bold font-headline inline-block">
|
| 43 |
+
Portfolio
|
| 44 |
+
</span>
|
| 45 |
+
</Link>
|
| 46 |
+
<nav className="hidden md:flex items-center space-x-6 text-sm font-medium">
|
| 47 |
+
{navItems.map((item) => (
|
| 48 |
+
<Link
|
| 49 |
+
key={item.name}
|
| 50 |
+
href={item.href}
|
| 51 |
+
className="transition-colors hover:text-primary"
|
| 52 |
+
>
|
| 53 |
+
{item.name}
|
| 54 |
+
</Link>
|
| 55 |
+
))}
|
| 56 |
+
</nav>
|
| 57 |
+
<div className="flex flex-1 items-center justify-end space-x-4">
|
| 58 |
+
<a
|
| 59 |
+
href="https://github.com/sameerbanchhor-git"
|
| 60 |
+
target="_blank"
|
| 61 |
+
rel="noopener noreferrer"
|
| 62 |
+
>
|
| 63 |
+
<Button variant="ghost" size="icon" aria-label="GitHub">
|
| 64 |
+
<Github className="h-5 w-5" />
|
| 65 |
+
</Button>
|
| 66 |
+
</a>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</header>
|
| 70 |
+
);
|
| 71 |
+
}
|
src/components/landing/hero.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Link from "next/link";
|
| 2 |
+
import { Button } from "@/components/ui/button";
|
| 3 |
+
import { ArrowDown } from "lucide-react";
|
| 4 |
+
import { aboutMe } from "@/lib/data";
|
| 5 |
+
|
| 6 |
+
export function Hero() {
|
| 7 |
+
return (
|
| 8 |
+
<section
|
| 9 |
+
id="hero"
|
| 10 |
+
className="relative flex min-h-[calc(100vh-4rem)] w-full items-center justify-center bg-gradient-to-b from-background to-secondary"
|
| 11 |
+
>
|
| 12 |
+
<div className="container text-center px-4 md:px-6">
|
| 13 |
+
<div className="flex flex-col items-center space-y-6">
|
| 14 |
+
<div className="space-y-4">
|
| 15 |
+
<h1 className="font-headline text-4xl font-bold tracking-tighter sm:text-5xl md:text-6xl lg:text-7xl/none bg-clip-text text-transparent bg-gradient-to-r from-primary via-accent to-primary">
|
| 16 |
+
{aboutMe.name}
|
| 17 |
+
</h1>
|
| 18 |
+
<p className="mx-auto max-w-[700px] text-muted-foreground md:text-xl">
|
| 19 |
+
{aboutMe.title}
|
| 20 |
+
</p>
|
| 21 |
+
</div>
|
| 22 |
+
<p className="max-w-[600px] text-foreground/80 md:text-lg">
|
| 23 |
+
Transforming data into insights and building intelligent solutions.
|
| 24 |
+
</p>
|
| 25 |
+
<Link href="#projects">
|
| 26 |
+
<Button size="lg" className="group">
|
| 27 |
+
View My Work
|
| 28 |
+
<ArrowDown className="ml-2 h-4 w-4 transition-transform group-hover:translate-y-1" />
|
| 29 |
+
</Button>
|
| 30 |
+
</Link>
|
| 31 |
+
</div>
|
| 32 |
+
</div>
|
| 33 |
+
</section>
|
| 34 |
+
);
|
| 35 |
+
}
|
src/components/landing/projects.tsx
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import { projects } from "@/lib/data";
|
| 4 |
+
import Image from "next/image";
|
| 5 |
+
import {
|
| 6 |
+
Card,
|
| 7 |
+
CardContent,
|
| 8 |
+
CardDescription,
|
| 9 |
+
CardFooter,
|
| 10 |
+
CardHeader,
|
| 11 |
+
CardTitle,
|
| 12 |
+
} from "@/components/ui/card";
|
| 13 |
+
import { Badge } from "@/components/ui/badge";
|
| 14 |
+
import { Button } from "@/components/ui/button";
|
| 15 |
+
import { Github, BarChart, Presentation } from "lucide-react";
|
| 16 |
+
|
| 17 |
+
const getProjectIcon = (id: number) => {
|
| 18 |
+
switch (id) {
|
| 19 |
+
case 1:
|
| 20 |
+
return <Presentation className="h-6 w-6 text-accent" />;
|
| 21 |
+
case 2:
|
| 22 |
+
return <BarChart className="h-6 w-6 text-accent" />;
|
| 23 |
+
default:
|
| 24 |
+
return null;
|
| 25 |
+
}
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
const projectImages: { [key: number]: { src: string; alt: string, hint: string } } = {
|
| 29 |
+
1: {
|
| 30 |
+
src: "https://raw.githubusercontent.com/sameerbanchhor-git/assets/main/Customer%20Churn%20Prediction.png",
|
| 31 |
+
alt: "Customer Churn Prediction project visual",
|
| 32 |
+
hint: "churn prediction"
|
| 33 |
+
},
|
| 34 |
+
2: {
|
| 35 |
+
src: "https://raw.githubusercontent.com/sameerbanchhor-git/assets/main/Real-Time%20Sentiment%20Analysis.jpg",
|
| 36 |
+
alt: "Real-Time Sentiment Analysis project visual",
|
| 37 |
+
hint: "sentiment analysis"
|
| 38 |
+
},
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
export function Projects() {
|
| 42 |
+
return (
|
| 43 |
+
<section id="projects" className="w-full py-12 md:py-24 lg:py-32 bg-secondary">
|
| 44 |
+
<div className="container px-4 md:px-6">
|
| 45 |
+
<div className="flex flex-col items-center justify-center space-y-4 text-center mb-12">
|
| 46 |
+
<h2 className="text-3xl font-headline font-bold tracking-tighter sm:text-5xl text-primary">
|
| 47 |
+
My Projects
|
| 48 |
+
</h2>
|
| 49 |
+
<p className="max-w-[900px] text-muted-foreground md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed">
|
| 50 |
+
Here are some of the projects I've worked on to apply and showcase
|
| 51 |
+
my skills in data science.
|
| 52 |
+
</p>
|
| 53 |
+
</div>
|
| 54 |
+
<div className="grid gap-8 md:grid-cols-1 lg:grid-cols-1">
|
| 55 |
+
{projects.map((project) => (
|
| 56 |
+
<Card
|
| 57 |
+
key={project.id}
|
| 58 |
+
className="flex flex-col overflow-hidden transition-all hover:shadow-lg"
|
| 59 |
+
>
|
| 60 |
+
<CardHeader className="flex flex-row items-start gap-4">
|
| 61 |
+
{getProjectIcon(project.id)}
|
| 62 |
+
<div>
|
| 63 |
+
<CardTitle className="font-headline text-2xl">
|
| 64 |
+
{project.title}
|
| 65 |
+
</CardTitle>
|
| 66 |
+
<CardDescription>{project.outcomes}</CardDescription>
|
| 67 |
+
</div>
|
| 68 |
+
</CardHeader>
|
| 69 |
+
<CardContent className="grid md:grid-cols-2 gap-6 flex-grow">
|
| 70 |
+
<div className="space-y-4">
|
| 71 |
+
<p className="text-foreground/80 break-words">{project.description}</p>
|
| 72 |
+
<div>
|
| 73 |
+
<h4 className="font-semibold mb-2">Methodologies:</h4>
|
| 74 |
+
<div className="flex flex-wrap gap-2">
|
| 75 |
+
{project.methodologies.map((method) => (
|
| 76 |
+
<Badge key={method} variant="secondary">
|
| 77 |
+
{method}
|
| 78 |
+
</Badge>
|
| 79 |
+
))}
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
<div className="flex items-center justify-center">
|
| 84 |
+
{projectImages[project.id] && (
|
| 85 |
+
<Image
|
| 86 |
+
src={projectImages[project.id].src}
|
| 87 |
+
alt={projectImages[project.id].alt}
|
| 88 |
+
data-ai-hint={projectImages[project.id].hint}
|
| 89 |
+
width={600}
|
| 90 |
+
height={400}
|
| 91 |
+
className="object-cover rounded-lg shadow-md border-2 border-accent"
|
| 92 |
+
/>
|
| 93 |
+
)}
|
| 94 |
+
</div>
|
| 95 |
+
</CardContent>
|
| 96 |
+
<CardFooter>
|
| 97 |
+
<a href={project.githubUrl} target="_blank" rel="noopener noreferrer">
|
| 98 |
+
<Button variant="outline">
|
| 99 |
+
<Github className="mr-2 h-4 w-4" />
|
| 100 |
+
View on GitHub
|
| 101 |
+
</Button>
|
| 102 |
+
</a>
|
| 103 |
+
</CardFooter>
|
| 104 |
+
</Card>
|
| 105 |
+
))}
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
</section>
|
| 109 |
+
);
|
| 110 |
+
}
|
src/components/landing/skills.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { extractSkills } from "@/ai/flows/skills-extraction";
|
| 2 |
+
import { projectDescriptions } from "@/lib/data";
|
| 3 |
+
import { Badge } from "@/components/ui/badge";
|
| 4 |
+
|
| 5 |
+
export async function Skills() {
|
| 6 |
+
let skills: string[] = [];
|
| 7 |
+
try {
|
| 8 |
+
const output = await extractSkills({ projectDescriptions });
|
| 9 |
+
skills = output.skills;
|
| 10 |
+
} catch (error) {
|
| 11 |
+
console.error("Error extracting skills:", error);
|
| 12 |
+
// Fallback skills in case of AI failure
|
| 13 |
+
skills = [
|
| 14 |
+
"Machine Learning",
|
| 15 |
+
"Data Analysis",
|
| 16 |
+
"Python",
|
| 17 |
+
"SQL",
|
| 18 |
+
"Pandas",
|
| 19 |
+
"NumPy",
|
| 20 |
+
"Scikit-learn",
|
| 21 |
+
"Time Series Analysis",
|
| 22 |
+
"NLP",
|
| 23 |
+
"Data Visualization",
|
| 24 |
+
];
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
return (
|
| 28 |
+
<section id="skills" className="w-full py-12 md:py-24 lg:py-32 bg-background">
|
| 29 |
+
<div className="container px-4 md:px-6">
|
| 30 |
+
<div className="flex flex-col items-center justify-center space-y-4 text-center">
|
| 31 |
+
<h2 className="text-3xl font-headline font-bold tracking-tighter sm:text-5xl text-primary">
|
| 32 |
+
Technical Skills
|
| 33 |
+
</h2>
|
| 34 |
+
<p className="max-w-[900px] text-muted-foreground md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed">
|
| 35 |
+
Key skills identified from my project work by a generative AI model.
|
| 36 |
+
</p>
|
| 37 |
+
</div>
|
| 38 |
+
<div className="mx-auto mt-10 max-w-4xl">
|
| 39 |
+
<div className="flex flex-wrap justify-center gap-3">
|
| 40 |
+
{skills.map((skill) => (
|
| 41 |
+
<Badge
|
| 42 |
+
key={skill}
|
| 43 |
+
className="text-sm px-4 py-2"
|
| 44 |
+
variant="default"
|
| 45 |
+
style={{
|
| 46 |
+
backgroundColor: "hsl(var(--primary))",
|
| 47 |
+
color: "hsl(var(--primary-foreground))",
|
| 48 |
+
}}
|
| 49 |
+
>
|
| 50 |
+
{skill}
|
| 51 |
+
</Badge>
|
| 52 |
+
))}
|
| 53 |
+
</div>
|
| 54 |
+
</div>
|
| 55 |
+
</div>
|
| 56 |
+
</section>
|
| 57 |
+
);
|
| 58 |
+
}
|
src/components/ui/accordion.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
| 5 |
+
import { ChevronDown } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const Accordion = AccordionPrimitive.Root
|
| 10 |
+
|
| 11 |
+
const AccordionItem = React.forwardRef<
|
| 12 |
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
| 13 |
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
| 14 |
+
>(({ className, ...props }, ref) => (
|
| 15 |
+
<AccordionPrimitive.Item
|
| 16 |
+
ref={ref}
|
| 17 |
+
className={cn("border-b", className)}
|
| 18 |
+
{...props}
|
| 19 |
+
/>
|
| 20 |
+
))
|
| 21 |
+
AccordionItem.displayName = "AccordionItem"
|
| 22 |
+
|
| 23 |
+
const AccordionTrigger = React.forwardRef<
|
| 24 |
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
| 25 |
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
| 26 |
+
>(({ className, children, ...props }, ref) => (
|
| 27 |
+
<AccordionPrimitive.Header className="flex">
|
| 28 |
+
<AccordionPrimitive.Trigger
|
| 29 |
+
ref={ref}
|
| 30 |
+
className={cn(
|
| 31 |
+
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
| 32 |
+
className
|
| 33 |
+
)}
|
| 34 |
+
{...props}
|
| 35 |
+
>
|
| 36 |
+
{children}
|
| 37 |
+
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
|
| 38 |
+
</AccordionPrimitive.Trigger>
|
| 39 |
+
</AccordionPrimitive.Header>
|
| 40 |
+
))
|
| 41 |
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
|
| 42 |
+
|
| 43 |
+
const AccordionContent = React.forwardRef<
|
| 44 |
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
| 45 |
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
| 46 |
+
>(({ className, children, ...props }, ref) => (
|
| 47 |
+
<AccordionPrimitive.Content
|
| 48 |
+
ref={ref}
|
| 49 |
+
className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
| 50 |
+
{...props}
|
| 51 |
+
>
|
| 52 |
+
<div className={cn("pb-4 pt-0", className)}>{children}</div>
|
| 53 |
+
</AccordionPrimitive.Content>
|
| 54 |
+
))
|
| 55 |
+
|
| 56 |
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName
|
| 57 |
+
|
| 58 |
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
src/components/ui/alert-dialog.tsx
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
import { buttonVariants } from "@/components/ui/button"
|
| 8 |
+
|
| 9 |
+
const AlertDialog = AlertDialogPrimitive.Root
|
| 10 |
+
|
| 11 |
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
| 12 |
+
|
| 13 |
+
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
| 14 |
+
|
| 15 |
+
const AlertDialogOverlay = React.forwardRef<
|
| 16 |
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
| 17 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
| 18 |
+
>(({ className, ...props }, ref) => (
|
| 19 |
+
<AlertDialogPrimitive.Overlay
|
| 20 |
+
className={cn(
|
| 21 |
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
| 22 |
+
className
|
| 23 |
+
)}
|
| 24 |
+
{...props}
|
| 25 |
+
ref={ref}
|
| 26 |
+
/>
|
| 27 |
+
))
|
| 28 |
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
| 29 |
+
|
| 30 |
+
const AlertDialogContent = React.forwardRef<
|
| 31 |
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
| 32 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
| 33 |
+
>(({ className, ...props }, ref) => (
|
| 34 |
+
<AlertDialogPortal>
|
| 35 |
+
<AlertDialogOverlay />
|
| 36 |
+
<AlertDialogPrimitive.Content
|
| 37 |
+
ref={ref}
|
| 38 |
+
className={cn(
|
| 39 |
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
| 40 |
+
className
|
| 41 |
+
)}
|
| 42 |
+
{...props}
|
| 43 |
+
/>
|
| 44 |
+
</AlertDialogPortal>
|
| 45 |
+
))
|
| 46 |
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
| 47 |
+
|
| 48 |
+
const AlertDialogHeader = ({
|
| 49 |
+
className,
|
| 50 |
+
...props
|
| 51 |
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
| 52 |
+
<div
|
| 53 |
+
className={cn(
|
| 54 |
+
"flex flex-col space-y-2 text-center sm:text-left",
|
| 55 |
+
className
|
| 56 |
+
)}
|
| 57 |
+
{...props}
|
| 58 |
+
/>
|
| 59 |
+
)
|
| 60 |
+
AlertDialogHeader.displayName = "AlertDialogHeader"
|
| 61 |
+
|
| 62 |
+
const AlertDialogFooter = ({
|
| 63 |
+
className,
|
| 64 |
+
...props
|
| 65 |
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
| 66 |
+
<div
|
| 67 |
+
className={cn(
|
| 68 |
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
| 69 |
+
className
|
| 70 |
+
)}
|
| 71 |
+
{...props}
|
| 72 |
+
/>
|
| 73 |
+
)
|
| 74 |
+
AlertDialogFooter.displayName = "AlertDialogFooter"
|
| 75 |
+
|
| 76 |
+
const AlertDialogTitle = React.forwardRef<
|
| 77 |
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
| 78 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
| 79 |
+
>(({ className, ...props }, ref) => (
|
| 80 |
+
<AlertDialogPrimitive.Title
|
| 81 |
+
ref={ref}
|
| 82 |
+
className={cn("text-lg font-semibold", className)}
|
| 83 |
+
{...props}
|
| 84 |
+
/>
|
| 85 |
+
))
|
| 86 |
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
| 87 |
+
|
| 88 |
+
const AlertDialogDescription = React.forwardRef<
|
| 89 |
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
| 90 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
| 91 |
+
>(({ className, ...props }, ref) => (
|
| 92 |
+
<AlertDialogPrimitive.Description
|
| 93 |
+
ref={ref}
|
| 94 |
+
className={cn("text-sm text-muted-foreground", className)}
|
| 95 |
+
{...props}
|
| 96 |
+
/>
|
| 97 |
+
))
|
| 98 |
+
AlertDialogDescription.displayName =
|
| 99 |
+
AlertDialogPrimitive.Description.displayName
|
| 100 |
+
|
| 101 |
+
const AlertDialogAction = React.forwardRef<
|
| 102 |
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
| 103 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
| 104 |
+
>(({ className, ...props }, ref) => (
|
| 105 |
+
<AlertDialogPrimitive.Action
|
| 106 |
+
ref={ref}
|
| 107 |
+
className={cn(buttonVariants(), className)}
|
| 108 |
+
{...props}
|
| 109 |
+
/>
|
| 110 |
+
))
|
| 111 |
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
| 112 |
+
|
| 113 |
+
const AlertDialogCancel = React.forwardRef<
|
| 114 |
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
| 115 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
| 116 |
+
>(({ className, ...props }, ref) => (
|
| 117 |
+
<AlertDialogPrimitive.Cancel
|
| 118 |
+
ref={ref}
|
| 119 |
+
className={cn(
|
| 120 |
+
buttonVariants({ variant: "outline" }),
|
| 121 |
+
"mt-2 sm:mt-0",
|
| 122 |
+
className
|
| 123 |
+
)}
|
| 124 |
+
{...props}
|
| 125 |
+
/>
|
| 126 |
+
))
|
| 127 |
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
| 128 |
+
|
| 129 |
+
export {
|
| 130 |
+
AlertDialog,
|
| 131 |
+
AlertDialogPortal,
|
| 132 |
+
AlertDialogOverlay,
|
| 133 |
+
AlertDialogTrigger,
|
| 134 |
+
AlertDialogContent,
|
| 135 |
+
AlertDialogHeader,
|
| 136 |
+
AlertDialogFooter,
|
| 137 |
+
AlertDialogTitle,
|
| 138 |
+
AlertDialogDescription,
|
| 139 |
+
AlertDialogAction,
|
| 140 |
+
AlertDialogCancel,
|
| 141 |
+
}
|
src/components/ui/alert.tsx
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import { cva, type VariantProps } from "class-variance-authority"
|
| 3 |
+
|
| 4 |
+
import { cn } from "@/lib/utils"
|
| 5 |
+
|
| 6 |
+
const alertVariants = cva(
|
| 7 |
+
"relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
|
| 8 |
+
{
|
| 9 |
+
variants: {
|
| 10 |
+
variant: {
|
| 11 |
+
default: "bg-background text-foreground",
|
| 12 |
+
destructive:
|
| 13 |
+
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
| 14 |
+
},
|
| 15 |
+
},
|
| 16 |
+
defaultVariants: {
|
| 17 |
+
variant: "default",
|
| 18 |
+
},
|
| 19 |
+
}
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
const Alert = React.forwardRef<
|
| 23 |
+
HTMLDivElement,
|
| 24 |
+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
| 25 |
+
>(({ className, variant, ...props }, ref) => (
|
| 26 |
+
<div
|
| 27 |
+
ref={ref}
|
| 28 |
+
role="alert"
|
| 29 |
+
className={cn(alertVariants({ variant }), className)}
|
| 30 |
+
{...props}
|
| 31 |
+
/>
|
| 32 |
+
))
|
| 33 |
+
Alert.displayName = "Alert"
|
| 34 |
+
|
| 35 |
+
const AlertTitle = React.forwardRef<
|
| 36 |
+
HTMLParagraphElement,
|
| 37 |
+
React.HTMLAttributes<HTMLHeadingElement>
|
| 38 |
+
>(({ className, ...props }, ref) => (
|
| 39 |
+
<h5
|
| 40 |
+
ref={ref}
|
| 41 |
+
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
| 42 |
+
{...props}
|
| 43 |
+
/>
|
| 44 |
+
))
|
| 45 |
+
AlertTitle.displayName = "AlertTitle"
|
| 46 |
+
|
| 47 |
+
const AlertDescription = React.forwardRef<
|
| 48 |
+
HTMLParagraphElement,
|
| 49 |
+
React.HTMLAttributes<HTMLParagraphElement>
|
| 50 |
+
>(({ className, ...props }, ref) => (
|
| 51 |
+
<div
|
| 52 |
+
ref={ref}
|
| 53 |
+
className={cn("text-sm [&_p]:leading-relaxed", className)}
|
| 54 |
+
{...props}
|
| 55 |
+
/>
|
| 56 |
+
))
|
| 57 |
+
AlertDescription.displayName = "AlertDescription"
|
| 58 |
+
|
| 59 |
+
export { Alert, AlertTitle, AlertDescription }
|
src/components/ui/avatar.tsx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as AvatarPrimitive from "@radix-ui/react-avatar"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
|
| 8 |
+
const Avatar = React.forwardRef<
|
| 9 |
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
| 10 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
| 11 |
+
>(({ className, ...props }, ref) => (
|
| 12 |
+
<AvatarPrimitive.Root
|
| 13 |
+
ref={ref}
|
| 14 |
+
className={cn(
|
| 15 |
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
| 16 |
+
className
|
| 17 |
+
)}
|
| 18 |
+
{...props}
|
| 19 |
+
/>
|
| 20 |
+
))
|
| 21 |
+
Avatar.displayName = AvatarPrimitive.Root.displayName
|
| 22 |
+
|
| 23 |
+
const AvatarImage = React.forwardRef<
|
| 24 |
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
| 25 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
| 26 |
+
>(({ className, ...props }, ref) => (
|
| 27 |
+
<AvatarPrimitive.Image
|
| 28 |
+
ref={ref}
|
| 29 |
+
className={cn("aspect-square h-full w-full", className)}
|
| 30 |
+
{...props}
|
| 31 |
+
/>
|
| 32 |
+
))
|
| 33 |
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
| 34 |
+
|
| 35 |
+
const AvatarFallback = React.forwardRef<
|
| 36 |
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
| 37 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
| 38 |
+
>(({ className, ...props }, ref) => (
|
| 39 |
+
<AvatarPrimitive.Fallback
|
| 40 |
+
ref={ref}
|
| 41 |
+
className={cn(
|
| 42 |
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
| 43 |
+
className
|
| 44 |
+
)}
|
| 45 |
+
{...props}
|
| 46 |
+
/>
|
| 47 |
+
))
|
| 48 |
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
| 49 |
+
|
| 50 |
+
export { Avatar, AvatarImage, AvatarFallback }
|
src/components/ui/badge.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import { cva, type VariantProps } from "class-variance-authority"
|
| 3 |
+
|
| 4 |
+
import { cn } from "@/lib/utils"
|
| 5 |
+
|
| 6 |
+
const badgeVariants = cva(
|
| 7 |
+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
| 8 |
+
{
|
| 9 |
+
variants: {
|
| 10 |
+
variant: {
|
| 11 |
+
default:
|
| 12 |
+
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
| 13 |
+
secondary:
|
| 14 |
+
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
| 15 |
+
destructive:
|
| 16 |
+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
| 17 |
+
outline: "text-foreground",
|
| 18 |
+
},
|
| 19 |
+
},
|
| 20 |
+
defaultVariants: {
|
| 21 |
+
variant: "default",
|
| 22 |
+
},
|
| 23 |
+
}
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
export interface BadgeProps
|
| 27 |
+
extends React.HTMLAttributes<HTMLDivElement>,
|
| 28 |
+
VariantProps<typeof badgeVariants> {}
|
| 29 |
+
|
| 30 |
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
| 31 |
+
return (
|
| 32 |
+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
| 33 |
+
)
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
export { Badge, badgeVariants }
|
src/components/ui/button.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import { Slot } from "@radix-ui/react-slot"
|
| 3 |
+
import { cva, type VariantProps } from "class-variance-authority"
|
| 4 |
+
|
| 5 |
+
import { cn } from "@/lib/utils"
|
| 6 |
+
|
| 7 |
+
const buttonVariants = cva(
|
| 8 |
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
| 9 |
+
{
|
| 10 |
+
variants: {
|
| 11 |
+
variant: {
|
| 12 |
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
| 13 |
+
destructive:
|
| 14 |
+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
| 15 |
+
outline:
|
| 16 |
+
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
| 17 |
+
secondary:
|
| 18 |
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
| 19 |
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
| 20 |
+
link: "text-primary underline-offset-4 hover:underline",
|
| 21 |
+
},
|
| 22 |
+
size: {
|
| 23 |
+
default: "h-10 px-4 py-2",
|
| 24 |
+
sm: "h-9 rounded-md px-3",
|
| 25 |
+
lg: "h-11 rounded-md px-8",
|
| 26 |
+
icon: "h-10 w-10",
|
| 27 |
+
},
|
| 28 |
+
},
|
| 29 |
+
defaultVariants: {
|
| 30 |
+
variant: "default",
|
| 31 |
+
size: "default",
|
| 32 |
+
},
|
| 33 |
+
}
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
export interface ButtonProps
|
| 37 |
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
| 38 |
+
VariantProps<typeof buttonVariants> {
|
| 39 |
+
asChild?: boolean
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
| 43 |
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
| 44 |
+
const Comp = asChild ? Slot : "button"
|
| 45 |
+
return (
|
| 46 |
+
<Comp
|
| 47 |
+
className={cn(buttonVariants({ variant, size, className }))}
|
| 48 |
+
ref={ref}
|
| 49 |
+
{...props}
|
| 50 |
+
/>
|
| 51 |
+
)
|
| 52 |
+
}
|
| 53 |
+
)
|
| 54 |
+
Button.displayName = "Button"
|
| 55 |
+
|
| 56 |
+
export { Button, buttonVariants }
|
src/components/ui/calendar.tsx
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import { ChevronLeft, ChevronRight } from "lucide-react"
|
| 5 |
+
import { DayPicker } from "react-day-picker"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
import { buttonVariants } from "@/components/ui/button"
|
| 9 |
+
|
| 10 |
+
export type CalendarProps = React.ComponentProps<typeof DayPicker>
|
| 11 |
+
|
| 12 |
+
function Calendar({
|
| 13 |
+
className,
|
| 14 |
+
classNames,
|
| 15 |
+
showOutsideDays = true,
|
| 16 |
+
...props
|
| 17 |
+
}: CalendarProps) {
|
| 18 |
+
return (
|
| 19 |
+
<DayPicker
|
| 20 |
+
showOutsideDays={showOutsideDays}
|
| 21 |
+
className={cn("p-3", className)}
|
| 22 |
+
classNames={{
|
| 23 |
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
| 24 |
+
month: "space-y-4",
|
| 25 |
+
caption: "flex justify-center pt-1 relative items-center",
|
| 26 |
+
caption_label: "text-sm font-medium",
|
| 27 |
+
nav: "space-x-1 flex items-center",
|
| 28 |
+
nav_button: cn(
|
| 29 |
+
buttonVariants({ variant: "outline" }),
|
| 30 |
+
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
| 31 |
+
),
|
| 32 |
+
nav_button_previous: "absolute left-1",
|
| 33 |
+
nav_button_next: "absolute right-1",
|
| 34 |
+
table: "w-full border-collapse space-y-1",
|
| 35 |
+
head_row: "flex",
|
| 36 |
+
head_cell:
|
| 37 |
+
"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
| 38 |
+
row: "flex w-full mt-2",
|
| 39 |
+
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
|
| 40 |
+
day: cn(
|
| 41 |
+
buttonVariants({ variant: "ghost" }),
|
| 42 |
+
"h-9 w-9 p-0 font-normal aria-selected:opacity-100"
|
| 43 |
+
),
|
| 44 |
+
day_range_end: "day-range-end",
|
| 45 |
+
day_selected:
|
| 46 |
+
"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
| 47 |
+
day_today: "bg-accent text-accent-foreground",
|
| 48 |
+
day_outside:
|
| 49 |
+
"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
|
| 50 |
+
day_disabled: "text-muted-foreground opacity-50",
|
| 51 |
+
day_range_middle:
|
| 52 |
+
"aria-selected:bg-accent aria-selected:text-accent-foreground",
|
| 53 |
+
day_hidden: "invisible",
|
| 54 |
+
...classNames,
|
| 55 |
+
}}
|
| 56 |
+
components={{
|
| 57 |
+
IconLeft: ({ className, ...props }) => (
|
| 58 |
+
<ChevronLeft className={cn("h-4 w-4", className)} {...props} />
|
| 59 |
+
),
|
| 60 |
+
IconRight: ({ className, ...props }) => (
|
| 61 |
+
<ChevronRight className={cn("h-4 w-4", className)} {...props} />
|
| 62 |
+
),
|
| 63 |
+
}}
|
| 64 |
+
{...props}
|
| 65 |
+
/>
|
| 66 |
+
)
|
| 67 |
+
}
|
| 68 |
+
Calendar.displayName = "Calendar"
|
| 69 |
+
|
| 70 |
+
export { Calendar }
|
src/components/ui/card.tsx
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
|
| 3 |
+
import { cn } from "@/lib/utils"
|
| 4 |
+
|
| 5 |
+
const Card = React.forwardRef<
|
| 6 |
+
HTMLDivElement,
|
| 7 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 8 |
+
>(({ className, ...props }, ref) => (
|
| 9 |
+
<div
|
| 10 |
+
ref={ref}
|
| 11 |
+
className={cn(
|
| 12 |
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
| 13 |
+
className
|
| 14 |
+
)}
|
| 15 |
+
{...props}
|
| 16 |
+
/>
|
| 17 |
+
))
|
| 18 |
+
Card.displayName = "Card"
|
| 19 |
+
|
| 20 |
+
const CardHeader = React.forwardRef<
|
| 21 |
+
HTMLDivElement,
|
| 22 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 23 |
+
>(({ className, ...props }, ref) => (
|
| 24 |
+
<div
|
| 25 |
+
ref={ref}
|
| 26 |
+
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
| 27 |
+
{...props}
|
| 28 |
+
/>
|
| 29 |
+
))
|
| 30 |
+
CardHeader.displayName = "CardHeader"
|
| 31 |
+
|
| 32 |
+
const CardTitle = React.forwardRef<
|
| 33 |
+
HTMLDivElement,
|
| 34 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 35 |
+
>(({ className, ...props }, ref) => (
|
| 36 |
+
<div
|
| 37 |
+
ref={ref}
|
| 38 |
+
className={cn(
|
| 39 |
+
"text-2xl font-semibold leading-none tracking-tight",
|
| 40 |
+
className
|
| 41 |
+
)}
|
| 42 |
+
{...props}
|
| 43 |
+
/>
|
| 44 |
+
))
|
| 45 |
+
CardTitle.displayName = "CardTitle"
|
| 46 |
+
|
| 47 |
+
const CardDescription = React.forwardRef<
|
| 48 |
+
HTMLDivElement,
|
| 49 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 50 |
+
>(({ className, ...props }, ref) => (
|
| 51 |
+
<div
|
| 52 |
+
ref={ref}
|
| 53 |
+
className={cn("text-sm text-muted-foreground", className)}
|
| 54 |
+
{...props}
|
| 55 |
+
/>
|
| 56 |
+
))
|
| 57 |
+
CardDescription.displayName = "CardDescription"
|
| 58 |
+
|
| 59 |
+
const CardContent = React.forwardRef<
|
| 60 |
+
HTMLDivElement,
|
| 61 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 62 |
+
>(({ className, ...props }, ref) => (
|
| 63 |
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
| 64 |
+
))
|
| 65 |
+
CardContent.displayName = "CardContent"
|
| 66 |
+
|
| 67 |
+
const CardFooter = React.forwardRef<
|
| 68 |
+
HTMLDivElement,
|
| 69 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 70 |
+
>(({ className, ...props }, ref) => (
|
| 71 |
+
<div
|
| 72 |
+
ref={ref}
|
| 73 |
+
className={cn("flex items-center p-6 pt-0", className)}
|
| 74 |
+
{...props}
|
| 75 |
+
/>
|
| 76 |
+
))
|
| 77 |
+
CardFooter.displayName = "CardFooter"
|
| 78 |
+
|
| 79 |
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
src/components/ui/carousel.tsx
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import useEmblaCarousel, {
|
| 5 |
+
type UseEmblaCarouselType,
|
| 6 |
+
} from "embla-carousel-react"
|
| 7 |
+
import { ArrowLeft, ArrowRight } from "lucide-react"
|
| 8 |
+
|
| 9 |
+
import { cn } from "@/lib/utils"
|
| 10 |
+
import { Button } from "@/components/ui/button"
|
| 11 |
+
|
| 12 |
+
type CarouselApi = UseEmblaCarouselType[1]
|
| 13 |
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
| 14 |
+
type CarouselOptions = UseCarouselParameters[0]
|
| 15 |
+
type CarouselPlugin = UseCarouselParameters[1]
|
| 16 |
+
|
| 17 |
+
type CarouselProps = {
|
| 18 |
+
opts?: CarouselOptions
|
| 19 |
+
plugins?: CarouselPlugin
|
| 20 |
+
orientation?: "horizontal" | "vertical"
|
| 21 |
+
setApi?: (api: CarouselApi) => void
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
type CarouselContextProps = {
|
| 25 |
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
|
| 26 |
+
api: ReturnType<typeof useEmblaCarousel>[1]
|
| 27 |
+
scrollPrev: () => void
|
| 28 |
+
scrollNext: () => void
|
| 29 |
+
canScrollPrev: boolean
|
| 30 |
+
canScrollNext: boolean
|
| 31 |
+
} & CarouselProps
|
| 32 |
+
|
| 33 |
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
| 34 |
+
|
| 35 |
+
function useCarousel() {
|
| 36 |
+
const context = React.useContext(CarouselContext)
|
| 37 |
+
|
| 38 |
+
if (!context) {
|
| 39 |
+
throw new Error("useCarousel must be used within a <Carousel />")
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return context
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
const Carousel = React.forwardRef<
|
| 46 |
+
HTMLDivElement,
|
| 47 |
+
React.HTMLAttributes<HTMLDivElement> & CarouselProps
|
| 48 |
+
>(
|
| 49 |
+
(
|
| 50 |
+
{
|
| 51 |
+
orientation = "horizontal",
|
| 52 |
+
opts,
|
| 53 |
+
setApi,
|
| 54 |
+
plugins,
|
| 55 |
+
className,
|
| 56 |
+
children,
|
| 57 |
+
...props
|
| 58 |
+
},
|
| 59 |
+
ref
|
| 60 |
+
) => {
|
| 61 |
+
const [carouselRef, api] = useEmblaCarousel(
|
| 62 |
+
{
|
| 63 |
+
...opts,
|
| 64 |
+
axis: orientation === "horizontal" ? "x" : "y",
|
| 65 |
+
},
|
| 66 |
+
plugins
|
| 67 |
+
)
|
| 68 |
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
|
| 69 |
+
const [canScrollNext, setCanScrollNext] = React.useState(false)
|
| 70 |
+
|
| 71 |
+
const onSelect = React.useCallback((api: CarouselApi) => {
|
| 72 |
+
if (!api) {
|
| 73 |
+
return
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
setCanScrollPrev(api.canScrollPrev())
|
| 77 |
+
setCanScrollNext(api.canScrollNext())
|
| 78 |
+
}, [])
|
| 79 |
+
|
| 80 |
+
const scrollPrev = React.useCallback(() => {
|
| 81 |
+
api?.scrollPrev()
|
| 82 |
+
}, [api])
|
| 83 |
+
|
| 84 |
+
const scrollNext = React.useCallback(() => {
|
| 85 |
+
api?.scrollNext()
|
| 86 |
+
}, [api])
|
| 87 |
+
|
| 88 |
+
const handleKeyDown = React.useCallback(
|
| 89 |
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
| 90 |
+
if (event.key === "ArrowLeft") {
|
| 91 |
+
event.preventDefault()
|
| 92 |
+
scrollPrev()
|
| 93 |
+
} else if (event.key === "ArrowRight") {
|
| 94 |
+
event.preventDefault()
|
| 95 |
+
scrollNext()
|
| 96 |
+
}
|
| 97 |
+
},
|
| 98 |
+
[scrollPrev, scrollNext]
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
React.useEffect(() => {
|
| 102 |
+
if (!api || !setApi) {
|
| 103 |
+
return
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
setApi(api)
|
| 107 |
+
}, [api, setApi])
|
| 108 |
+
|
| 109 |
+
React.useEffect(() => {
|
| 110 |
+
if (!api) {
|
| 111 |
+
return
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
onSelect(api)
|
| 115 |
+
api.on("reInit", onSelect)
|
| 116 |
+
api.on("select", onSelect)
|
| 117 |
+
|
| 118 |
+
return () => {
|
| 119 |
+
api?.off("select", onSelect)
|
| 120 |
+
}
|
| 121 |
+
}, [api, onSelect])
|
| 122 |
+
|
| 123 |
+
return (
|
| 124 |
+
<CarouselContext.Provider
|
| 125 |
+
value={{
|
| 126 |
+
carouselRef,
|
| 127 |
+
api: api,
|
| 128 |
+
opts,
|
| 129 |
+
orientation:
|
| 130 |
+
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
| 131 |
+
scrollPrev,
|
| 132 |
+
scrollNext,
|
| 133 |
+
canScrollPrev,
|
| 134 |
+
canScrollNext,
|
| 135 |
+
}}
|
| 136 |
+
>
|
| 137 |
+
<div
|
| 138 |
+
ref={ref}
|
| 139 |
+
onKeyDownCapture={handleKeyDown}
|
| 140 |
+
className={cn("relative", className)}
|
| 141 |
+
role="region"
|
| 142 |
+
aria-roledescription="carousel"
|
| 143 |
+
{...props}
|
| 144 |
+
>
|
| 145 |
+
{children}
|
| 146 |
+
</div>
|
| 147 |
+
</CarouselContext.Provider>
|
| 148 |
+
)
|
| 149 |
+
}
|
| 150 |
+
)
|
| 151 |
+
Carousel.displayName = "Carousel"
|
| 152 |
+
|
| 153 |
+
const CarouselContent = React.forwardRef<
|
| 154 |
+
HTMLDivElement,
|
| 155 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 156 |
+
>(({ className, ...props }, ref) => {
|
| 157 |
+
const { carouselRef, orientation } = useCarousel()
|
| 158 |
+
|
| 159 |
+
return (
|
| 160 |
+
<div ref={carouselRef} className="overflow-hidden">
|
| 161 |
+
<div
|
| 162 |
+
ref={ref}
|
| 163 |
+
className={cn(
|
| 164 |
+
"flex",
|
| 165 |
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
| 166 |
+
className
|
| 167 |
+
)}
|
| 168 |
+
{...props}
|
| 169 |
+
/>
|
| 170 |
+
</div>
|
| 171 |
+
)
|
| 172 |
+
})
|
| 173 |
+
CarouselContent.displayName = "CarouselContent"
|
| 174 |
+
|
| 175 |
+
const CarouselItem = React.forwardRef<
|
| 176 |
+
HTMLDivElement,
|
| 177 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 178 |
+
>(({ className, ...props }, ref) => {
|
| 179 |
+
const { orientation } = useCarousel()
|
| 180 |
+
|
| 181 |
+
return (
|
| 182 |
+
<div
|
| 183 |
+
ref={ref}
|
| 184 |
+
role="group"
|
| 185 |
+
aria-roledescription="slide"
|
| 186 |
+
className={cn(
|
| 187 |
+
"min-w-0 shrink-0 grow-0 basis-full",
|
| 188 |
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
| 189 |
+
className
|
| 190 |
+
)}
|
| 191 |
+
{...props}
|
| 192 |
+
/>
|
| 193 |
+
)
|
| 194 |
+
})
|
| 195 |
+
CarouselItem.displayName = "CarouselItem"
|
| 196 |
+
|
| 197 |
+
const CarouselPrevious = React.forwardRef<
|
| 198 |
+
HTMLButtonElement,
|
| 199 |
+
React.ComponentProps<typeof Button>
|
| 200 |
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
| 201 |
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
| 202 |
+
|
| 203 |
+
return (
|
| 204 |
+
<Button
|
| 205 |
+
ref={ref}
|
| 206 |
+
variant={variant}
|
| 207 |
+
size={size}
|
| 208 |
+
className={cn(
|
| 209 |
+
"absolute h-8 w-8 rounded-full",
|
| 210 |
+
orientation === "horizontal"
|
| 211 |
+
? "-left-12 top-1/2 -translate-y-1/2"
|
| 212 |
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
| 213 |
+
className
|
| 214 |
+
)}
|
| 215 |
+
disabled={!canScrollPrev}
|
| 216 |
+
onClick={scrollPrev}
|
| 217 |
+
{...props}
|
| 218 |
+
>
|
| 219 |
+
<ArrowLeft className="h-4 w-4" />
|
| 220 |
+
<span className="sr-only">Previous slide</span>
|
| 221 |
+
</Button>
|
| 222 |
+
)
|
| 223 |
+
})
|
| 224 |
+
CarouselPrevious.displayName = "CarouselPrevious"
|
| 225 |
+
|
| 226 |
+
const CarouselNext = React.forwardRef<
|
| 227 |
+
HTMLButtonElement,
|
| 228 |
+
React.ComponentProps<typeof Button>
|
| 229 |
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
| 230 |
+
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
| 231 |
+
|
| 232 |
+
return (
|
| 233 |
+
<Button
|
| 234 |
+
ref={ref}
|
| 235 |
+
variant={variant}
|
| 236 |
+
size={size}
|
| 237 |
+
className={cn(
|
| 238 |
+
"absolute h-8 w-8 rounded-full",
|
| 239 |
+
orientation === "horizontal"
|
| 240 |
+
? "-right-12 top-1/2 -translate-y-1/2"
|
| 241 |
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
| 242 |
+
className
|
| 243 |
+
)}
|
| 244 |
+
disabled={!canScrollNext}
|
| 245 |
+
onClick={scrollNext}
|
| 246 |
+
{...props}
|
| 247 |
+
>
|
| 248 |
+
<ArrowRight className="h-4 w-4" />
|
| 249 |
+
<span className="sr-only">Next slide</span>
|
| 250 |
+
</Button>
|
| 251 |
+
)
|
| 252 |
+
})
|
| 253 |
+
CarouselNext.displayName = "CarouselNext"
|
| 254 |
+
|
| 255 |
+
export {
|
| 256 |
+
type CarouselApi,
|
| 257 |
+
Carousel,
|
| 258 |
+
CarouselContent,
|
| 259 |
+
CarouselItem,
|
| 260 |
+
CarouselPrevious,
|
| 261 |
+
CarouselNext,
|
| 262 |
+
}
|
src/components/ui/chart.tsx
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as RechartsPrimitive from "recharts"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
|
| 8 |
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
| 9 |
+
const THEMES = { light: "", dark: ".dark" } as const
|
| 10 |
+
|
| 11 |
+
export type ChartConfig = {
|
| 12 |
+
[k in string]: {
|
| 13 |
+
label?: React.ReactNode
|
| 14 |
+
icon?: React.ComponentType
|
| 15 |
+
} & (
|
| 16 |
+
| { color?: string; theme?: never }
|
| 17 |
+
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
| 18 |
+
)
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
type ChartContextProps = {
|
| 22 |
+
config: ChartConfig
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
const ChartContext = React.createContext<ChartContextProps | null>(null)
|
| 26 |
+
|
| 27 |
+
function useChart() {
|
| 28 |
+
const context = React.useContext(ChartContext)
|
| 29 |
+
|
| 30 |
+
if (!context) {
|
| 31 |
+
throw new Error("useChart must be used within a <ChartContainer />")
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
return context
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
const ChartContainer = React.forwardRef<
|
| 38 |
+
HTMLDivElement,
|
| 39 |
+
React.ComponentProps<"div"> & {
|
| 40 |
+
config: ChartConfig
|
| 41 |
+
children: React.ComponentProps<
|
| 42 |
+
typeof RechartsPrimitive.ResponsiveContainer
|
| 43 |
+
>["children"]
|
| 44 |
+
}
|
| 45 |
+
>(({ id, className, children, config, ...props }, ref) => {
|
| 46 |
+
const uniqueId = React.useId()
|
| 47 |
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
|
| 48 |
+
|
| 49 |
+
return (
|
| 50 |
+
<ChartContext.Provider value={{ config }}>
|
| 51 |
+
<div
|
| 52 |
+
data-chart={chartId}
|
| 53 |
+
ref={ref}
|
| 54 |
+
className={cn(
|
| 55 |
+
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
| 56 |
+
className
|
| 57 |
+
)}
|
| 58 |
+
{...props}
|
| 59 |
+
>
|
| 60 |
+
<ChartStyle id={chartId} config={config} />
|
| 61 |
+
<RechartsPrimitive.ResponsiveContainer>
|
| 62 |
+
{children}
|
| 63 |
+
</RechartsPrimitive.ResponsiveContainer>
|
| 64 |
+
</div>
|
| 65 |
+
</ChartContext.Provider>
|
| 66 |
+
)
|
| 67 |
+
})
|
| 68 |
+
ChartContainer.displayName = "Chart"
|
| 69 |
+
|
| 70 |
+
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
| 71 |
+
const colorConfig = Object.entries(config).filter(
|
| 72 |
+
([, config]) => config.theme || config.color
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
if (!colorConfig.length) {
|
| 76 |
+
return null
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
return (
|
| 80 |
+
<style
|
| 81 |
+
dangerouslySetInnerHTML={{
|
| 82 |
+
__html: Object.entries(THEMES)
|
| 83 |
+
.map(
|
| 84 |
+
([theme, prefix]) => `
|
| 85 |
+
${prefix} [data-chart=${id}] {
|
| 86 |
+
${colorConfig
|
| 87 |
+
.map(([key, itemConfig]) => {
|
| 88 |
+
const color =
|
| 89 |
+
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
|
| 90 |
+
itemConfig.color
|
| 91 |
+
return color ? ` --color-${key}: ${color};` : null
|
| 92 |
+
})
|
| 93 |
+
.join("\n")}
|
| 94 |
+
}
|
| 95 |
+
`
|
| 96 |
+
)
|
| 97 |
+
.join("\n"),
|
| 98 |
+
}}
|
| 99 |
+
/>
|
| 100 |
+
)
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
const ChartTooltip = RechartsPrimitive.Tooltip
|
| 104 |
+
|
| 105 |
+
const ChartTooltipContent = React.forwardRef<
|
| 106 |
+
HTMLDivElement,
|
| 107 |
+
React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
| 108 |
+
React.ComponentProps<"div"> & {
|
| 109 |
+
hideLabel?: boolean
|
| 110 |
+
hideIndicator?: boolean
|
| 111 |
+
indicator?: "line" | "dot" | "dashed"
|
| 112 |
+
nameKey?: string
|
| 113 |
+
labelKey?: string
|
| 114 |
+
}
|
| 115 |
+
>(
|
| 116 |
+
(
|
| 117 |
+
{
|
| 118 |
+
active,
|
| 119 |
+
payload,
|
| 120 |
+
className,
|
| 121 |
+
indicator = "dot",
|
| 122 |
+
hideLabel = false,
|
| 123 |
+
hideIndicator = false,
|
| 124 |
+
label,
|
| 125 |
+
labelFormatter,
|
| 126 |
+
labelClassName,
|
| 127 |
+
formatter,
|
| 128 |
+
color,
|
| 129 |
+
nameKey,
|
| 130 |
+
labelKey,
|
| 131 |
+
},
|
| 132 |
+
ref
|
| 133 |
+
) => {
|
| 134 |
+
const { config } = useChart()
|
| 135 |
+
|
| 136 |
+
const tooltipLabel = React.useMemo(() => {
|
| 137 |
+
if (hideLabel || !payload?.length) {
|
| 138 |
+
return null
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
const [item] = payload
|
| 142 |
+
const key = `${labelKey || item.dataKey || item.name || "value"}`
|
| 143 |
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
| 144 |
+
const value =
|
| 145 |
+
!labelKey && typeof label === "string"
|
| 146 |
+
? config[label as keyof typeof config]?.label || label
|
| 147 |
+
: itemConfig?.label
|
| 148 |
+
|
| 149 |
+
if (labelFormatter) {
|
| 150 |
+
return (
|
| 151 |
+
<div className={cn("font-medium", labelClassName)}>
|
| 152 |
+
{labelFormatter(value, payload)}
|
| 153 |
+
</div>
|
| 154 |
+
)
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
if (!value) {
|
| 158 |
+
return null
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>
|
| 162 |
+
}, [
|
| 163 |
+
label,
|
| 164 |
+
labelFormatter,
|
| 165 |
+
payload,
|
| 166 |
+
hideLabel,
|
| 167 |
+
labelClassName,
|
| 168 |
+
config,
|
| 169 |
+
labelKey,
|
| 170 |
+
])
|
| 171 |
+
|
| 172 |
+
if (!active || !payload?.length) {
|
| 173 |
+
return null
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
const nestLabel = payload.length === 1 && indicator !== "dot"
|
| 177 |
+
|
| 178 |
+
return (
|
| 179 |
+
<div
|
| 180 |
+
ref={ref}
|
| 181 |
+
className={cn(
|
| 182 |
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
| 183 |
+
className
|
| 184 |
+
)}
|
| 185 |
+
>
|
| 186 |
+
{!nestLabel ? tooltipLabel : null}
|
| 187 |
+
<div className="grid gap-1.5">
|
| 188 |
+
{payload.map((item, index) => {
|
| 189 |
+
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
| 190 |
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
| 191 |
+
const indicatorColor = color || item.payload.fill || item.color
|
| 192 |
+
|
| 193 |
+
return (
|
| 194 |
+
<div
|
| 195 |
+
key={item.dataKey}
|
| 196 |
+
className={cn(
|
| 197 |
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
| 198 |
+
indicator === "dot" && "items-center"
|
| 199 |
+
)}
|
| 200 |
+
>
|
| 201 |
+
{formatter && item?.value !== undefined && item.name ? (
|
| 202 |
+
formatter(item.value, item.name, item, index, item.payload)
|
| 203 |
+
) : (
|
| 204 |
+
<>
|
| 205 |
+
{itemConfig?.icon ? (
|
| 206 |
+
<itemConfig.icon />
|
| 207 |
+
) : (
|
| 208 |
+
!hideIndicator && (
|
| 209 |
+
<div
|
| 210 |
+
className={cn(
|
| 211 |
+
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
|
| 212 |
+
{
|
| 213 |
+
"h-2.5 w-2.5": indicator === "dot",
|
| 214 |
+
"w-1": indicator === "line",
|
| 215 |
+
"w-0 border-[1.5px] border-dashed bg-transparent":
|
| 216 |
+
indicator === "dashed",
|
| 217 |
+
"my-0.5": nestLabel && indicator === "dashed",
|
| 218 |
+
}
|
| 219 |
+
)}
|
| 220 |
+
style={
|
| 221 |
+
{
|
| 222 |
+
"--color-bg": indicatorColor,
|
| 223 |
+
"--color-border": indicatorColor,
|
| 224 |
+
} as React.CSSProperties
|
| 225 |
+
}
|
| 226 |
+
/>
|
| 227 |
+
)
|
| 228 |
+
)}
|
| 229 |
+
<div
|
| 230 |
+
className={cn(
|
| 231 |
+
"flex flex-1 justify-between leading-none",
|
| 232 |
+
nestLabel ? "items-end" : "items-center"
|
| 233 |
+
)}
|
| 234 |
+
>
|
| 235 |
+
<div className="grid gap-1.5">
|
| 236 |
+
{nestLabel ? tooltipLabel : null}
|
| 237 |
+
<span className="text-muted-foreground">
|
| 238 |
+
{itemConfig?.label || item.name}
|
| 239 |
+
</span>
|
| 240 |
+
</div>
|
| 241 |
+
{item.value && (
|
| 242 |
+
<span className="font-mono font-medium tabular-nums text-foreground">
|
| 243 |
+
{item.value.toLocaleString()}
|
| 244 |
+
</span>
|
| 245 |
+
)}
|
| 246 |
+
</div>
|
| 247 |
+
</>
|
| 248 |
+
)}
|
| 249 |
+
</div>
|
| 250 |
+
)
|
| 251 |
+
})}
|
| 252 |
+
</div>
|
| 253 |
+
</div>
|
| 254 |
+
)
|
| 255 |
+
}
|
| 256 |
+
)
|
| 257 |
+
ChartTooltipContent.displayName = "ChartTooltip"
|
| 258 |
+
|
| 259 |
+
const ChartLegend = RechartsPrimitive.Legend
|
| 260 |
+
|
| 261 |
+
const ChartLegendContent = React.forwardRef<
|
| 262 |
+
HTMLDivElement,
|
| 263 |
+
React.ComponentProps<"div"> &
|
| 264 |
+
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
| 265 |
+
hideIcon?: boolean
|
| 266 |
+
nameKey?: string
|
| 267 |
+
}
|
| 268 |
+
>(
|
| 269 |
+
(
|
| 270 |
+
{ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
|
| 271 |
+
ref
|
| 272 |
+
) => {
|
| 273 |
+
const { config } = useChart()
|
| 274 |
+
|
| 275 |
+
if (!payload?.length) {
|
| 276 |
+
return null
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
return (
|
| 280 |
+
<div
|
| 281 |
+
ref={ref}
|
| 282 |
+
className={cn(
|
| 283 |
+
"flex items-center justify-center gap-4",
|
| 284 |
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
| 285 |
+
className
|
| 286 |
+
)}
|
| 287 |
+
>
|
| 288 |
+
{payload.map((item) => {
|
| 289 |
+
const key = `${nameKey || item.dataKey || "value"}`
|
| 290 |
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
| 291 |
+
|
| 292 |
+
return (
|
| 293 |
+
<div
|
| 294 |
+
key={item.value}
|
| 295 |
+
className={cn(
|
| 296 |
+
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
| 297 |
+
)}
|
| 298 |
+
>
|
| 299 |
+
{itemConfig?.icon && !hideIcon ? (
|
| 300 |
+
<itemConfig.icon />
|
| 301 |
+
) : (
|
| 302 |
+
<div
|
| 303 |
+
className="h-2 w-2 shrink-0 rounded-[2px]"
|
| 304 |
+
style={{
|
| 305 |
+
backgroundColor: item.color,
|
| 306 |
+
}}
|
| 307 |
+
/>
|
| 308 |
+
)}
|
| 309 |
+
{itemConfig?.label}
|
| 310 |
+
</div>
|
| 311 |
+
)
|
| 312 |
+
})}
|
| 313 |
+
</div>
|
| 314 |
+
)
|
| 315 |
+
}
|
| 316 |
+
)
|
| 317 |
+
ChartLegendContent.displayName = "ChartLegend"
|
| 318 |
+
|
| 319 |
+
// Helper to extract item config from a payload.
|
| 320 |
+
function getPayloadConfigFromPayload(
|
| 321 |
+
config: ChartConfig,
|
| 322 |
+
payload: unknown,
|
| 323 |
+
key: string
|
| 324 |
+
) {
|
| 325 |
+
if (typeof payload !== "object" || payload === null) {
|
| 326 |
+
return undefined
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
const payloadPayload =
|
| 330 |
+
"payload" in payload &&
|
| 331 |
+
typeof payload.payload === "object" &&
|
| 332 |
+
payload.payload !== null
|
| 333 |
+
? payload.payload
|
| 334 |
+
: undefined
|
| 335 |
+
|
| 336 |
+
let configLabelKey: string = key
|
| 337 |
+
|
| 338 |
+
if (
|
| 339 |
+
key in payload &&
|
| 340 |
+
typeof payload[key as keyof typeof payload] === "string"
|
| 341 |
+
) {
|
| 342 |
+
configLabelKey = payload[key as keyof typeof payload] as string
|
| 343 |
+
} else if (
|
| 344 |
+
payloadPayload &&
|
| 345 |
+
key in payloadPayload &&
|
| 346 |
+
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
| 347 |
+
) {
|
| 348 |
+
configLabelKey = payloadPayload[
|
| 349 |
+
key as keyof typeof payloadPayload
|
| 350 |
+
] as string
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
return configLabelKey in config
|
| 354 |
+
? config[configLabelKey]
|
| 355 |
+
: config[key as keyof typeof config]
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
export {
|
| 359 |
+
ChartContainer,
|
| 360 |
+
ChartTooltip,
|
| 361 |
+
ChartTooltipContent,
|
| 362 |
+
ChartLegend,
|
| 363 |
+
ChartLegendContent,
|
| 364 |
+
ChartStyle,
|
| 365 |
+
}
|
src/components/ui/checkbox.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
| 5 |
+
import { Check } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const Checkbox = React.forwardRef<
|
| 10 |
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
| 11 |
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
| 12 |
+
>(({ className, ...props }, ref) => (
|
| 13 |
+
<CheckboxPrimitive.Root
|
| 14 |
+
ref={ref}
|
| 15 |
+
className={cn(
|
| 16 |
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
| 17 |
+
className
|
| 18 |
+
)}
|
| 19 |
+
{...props}
|
| 20 |
+
>
|
| 21 |
+
<CheckboxPrimitive.Indicator
|
| 22 |
+
className={cn("flex items-center justify-center text-current")}
|
| 23 |
+
>
|
| 24 |
+
<Check className="h-4 w-4" />
|
| 25 |
+
</CheckboxPrimitive.Indicator>
|
| 26 |
+
</CheckboxPrimitive.Root>
|
| 27 |
+
))
|
| 28 |
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
| 29 |
+
|
| 30 |
+
export { Checkbox }
|
src/components/ui/collapsible.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
| 4 |
+
|
| 5 |
+
const Collapsible = CollapsiblePrimitive.Root
|
| 6 |
+
|
| 7 |
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
|
| 8 |
+
|
| 9 |
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
|
| 10 |
+
|
| 11 |
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
src/components/ui/dialog.tsx
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
| 5 |
+
import { X } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const Dialog = DialogPrimitive.Root
|
| 10 |
+
|
| 11 |
+
const DialogTrigger = DialogPrimitive.Trigger
|
| 12 |
+
|
| 13 |
+
const DialogPortal = DialogPrimitive.Portal
|
| 14 |
+
|
| 15 |
+
const DialogClose = DialogPrimitive.Close
|
| 16 |
+
|
| 17 |
+
const DialogOverlay = React.forwardRef<
|
| 18 |
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
| 19 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
| 20 |
+
>(({ className, ...props }, ref) => (
|
| 21 |
+
<DialogPrimitive.Overlay
|
| 22 |
+
ref={ref}
|
| 23 |
+
className={cn(
|
| 24 |
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
| 25 |
+
className
|
| 26 |
+
)}
|
| 27 |
+
{...props}
|
| 28 |
+
/>
|
| 29 |
+
))
|
| 30 |
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
| 31 |
+
|
| 32 |
+
const DialogContent = React.forwardRef<
|
| 33 |
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
| 34 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
| 35 |
+
>(({ className, children, ...props }, ref) => (
|
| 36 |
+
<DialogPortal>
|
| 37 |
+
<DialogOverlay />
|
| 38 |
+
<DialogPrimitive.Content
|
| 39 |
+
ref={ref}
|
| 40 |
+
className={cn(
|
| 41 |
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
| 42 |
+
className
|
| 43 |
+
)}
|
| 44 |
+
{...props}
|
| 45 |
+
>
|
| 46 |
+
{children}
|
| 47 |
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
| 48 |
+
<X className="h-4 w-4" />
|
| 49 |
+
<span className="sr-only">Close</span>
|
| 50 |
+
</DialogPrimitive.Close>
|
| 51 |
+
</DialogPrimitive.Content>
|
| 52 |
+
</DialogPortal>
|
| 53 |
+
))
|
| 54 |
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
| 55 |
+
|
| 56 |
+
const DialogHeader = ({
|
| 57 |
+
className,
|
| 58 |
+
...props
|
| 59 |
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
| 60 |
+
<div
|
| 61 |
+
className={cn(
|
| 62 |
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
| 63 |
+
className
|
| 64 |
+
)}
|
| 65 |
+
{...props}
|
| 66 |
+
/>
|
| 67 |
+
)
|
| 68 |
+
DialogHeader.displayName = "DialogHeader"
|
| 69 |
+
|
| 70 |
+
const DialogFooter = ({
|
| 71 |
+
className,
|
| 72 |
+
...props
|
| 73 |
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
| 74 |
+
<div
|
| 75 |
+
className={cn(
|
| 76 |
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
| 77 |
+
className
|
| 78 |
+
)}
|
| 79 |
+
{...props}
|
| 80 |
+
/>
|
| 81 |
+
)
|
| 82 |
+
DialogFooter.displayName = "DialogFooter"
|
| 83 |
+
|
| 84 |
+
const DialogTitle = React.forwardRef<
|
| 85 |
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
| 86 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
| 87 |
+
>(({ className, ...props }, ref) => (
|
| 88 |
+
<DialogPrimitive.Title
|
| 89 |
+
ref={ref}
|
| 90 |
+
className={cn(
|
| 91 |
+
"text-lg font-semibold leading-none tracking-tight",
|
| 92 |
+
className
|
| 93 |
+
)}
|
| 94 |
+
{...props}
|
| 95 |
+
/>
|
| 96 |
+
))
|
| 97 |
+
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
| 98 |
+
|
| 99 |
+
const DialogDescription = React.forwardRef<
|
| 100 |
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
| 101 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
| 102 |
+
>(({ className, ...props }, ref) => (
|
| 103 |
+
<DialogPrimitive.Description
|
| 104 |
+
ref={ref}
|
| 105 |
+
className={cn("text-sm text-muted-foreground", className)}
|
| 106 |
+
{...props}
|
| 107 |
+
/>
|
| 108 |
+
))
|
| 109 |
+
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
| 110 |
+
|
| 111 |
+
export {
|
| 112 |
+
Dialog,
|
| 113 |
+
DialogPortal,
|
| 114 |
+
DialogOverlay,
|
| 115 |
+
DialogClose,
|
| 116 |
+
DialogTrigger,
|
| 117 |
+
DialogContent,
|
| 118 |
+
DialogHeader,
|
| 119 |
+
DialogFooter,
|
| 120 |
+
DialogTitle,
|
| 121 |
+
DialogDescription,
|
| 122 |
+
}
|
src/components/ui/dropdown-menu.tsx
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
| 5 |
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
| 10 |
+
|
| 11 |
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
| 12 |
+
|
| 13 |
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
| 14 |
+
|
| 15 |
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
| 16 |
+
|
| 17 |
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
| 18 |
+
|
| 19 |
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
| 20 |
+
|
| 21 |
+
const DropdownMenuSubTrigger = React.forwardRef<
|
| 22 |
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
| 23 |
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
| 24 |
+
inset?: boolean
|
| 25 |
+
}
|
| 26 |
+
>(({ className, inset, children, ...props }, ref) => (
|
| 27 |
+
<DropdownMenuPrimitive.SubTrigger
|
| 28 |
+
ref={ref}
|
| 29 |
+
className={cn(
|
| 30 |
+
"flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
| 31 |
+
inset && "pl-8",
|
| 32 |
+
className
|
| 33 |
+
)}
|
| 34 |
+
{...props}
|
| 35 |
+
>
|
| 36 |
+
{children}
|
| 37 |
+
<ChevronRight className="ml-auto" />
|
| 38 |
+
</DropdownMenuPrimitive.SubTrigger>
|
| 39 |
+
))
|
| 40 |
+
DropdownMenuSubTrigger.displayName =
|
| 41 |
+
DropdownMenuPrimitive.SubTrigger.displayName
|
| 42 |
+
|
| 43 |
+
const DropdownMenuSubContent = React.forwardRef<
|
| 44 |
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
| 45 |
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
| 46 |
+
>(({ className, ...props }, ref) => (
|
| 47 |
+
<DropdownMenuPrimitive.SubContent
|
| 48 |
+
ref={ref}
|
| 49 |
+
className={cn(
|
| 50 |
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
| 51 |
+
className
|
| 52 |
+
)}
|
| 53 |
+
{...props}
|
| 54 |
+
/>
|
| 55 |
+
))
|
| 56 |
+
DropdownMenuSubContent.displayName =
|
| 57 |
+
DropdownMenuPrimitive.SubContent.displayName
|
| 58 |
+
|
| 59 |
+
const DropdownMenuContent = React.forwardRef<
|
| 60 |
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
| 61 |
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
| 62 |
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
| 63 |
+
<DropdownMenuPrimitive.Portal>
|
| 64 |
+
<DropdownMenuPrimitive.Content
|
| 65 |
+
ref={ref}
|
| 66 |
+
sideOffset={sideOffset}
|
| 67 |
+
className={cn(
|
| 68 |
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
| 69 |
+
className
|
| 70 |
+
)}
|
| 71 |
+
{...props}
|
| 72 |
+
/>
|
| 73 |
+
</DropdownMenuPrimitive.Portal>
|
| 74 |
+
))
|
| 75 |
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
| 76 |
+
|
| 77 |
+
const DropdownMenuItem = React.forwardRef<
|
| 78 |
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
| 79 |
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
| 80 |
+
inset?: boolean
|
| 81 |
+
}
|
| 82 |
+
>(({ className, inset, ...props }, ref) => (
|
| 83 |
+
<DropdownMenuPrimitive.Item
|
| 84 |
+
ref={ref}
|
| 85 |
+
className={cn(
|
| 86 |
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
| 87 |
+
inset && "pl-8",
|
| 88 |
+
className
|
| 89 |
+
)}
|
| 90 |
+
{...props}
|
| 91 |
+
/>
|
| 92 |
+
))
|
| 93 |
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
| 94 |
+
|
| 95 |
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
| 96 |
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
| 97 |
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
| 98 |
+
>(({ className, children, checked, ...props }, ref) => (
|
| 99 |
+
<DropdownMenuPrimitive.CheckboxItem
|
| 100 |
+
ref={ref}
|
| 101 |
+
className={cn(
|
| 102 |
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 103 |
+
className
|
| 104 |
+
)}
|
| 105 |
+
checked={checked}
|
| 106 |
+
{...props}
|
| 107 |
+
>
|
| 108 |
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
| 109 |
+
<DropdownMenuPrimitive.ItemIndicator>
|
| 110 |
+
<Check className="h-4 w-4" />
|
| 111 |
+
</DropdownMenuPrimitive.ItemIndicator>
|
| 112 |
+
</span>
|
| 113 |
+
{children}
|
| 114 |
+
</DropdownMenuPrimitive.CheckboxItem>
|
| 115 |
+
))
|
| 116 |
+
DropdownMenuCheckboxItem.displayName =
|
| 117 |
+
DropdownMenuPrimitive.CheckboxItem.displayName
|
| 118 |
+
|
| 119 |
+
const DropdownMenuRadioItem = React.forwardRef<
|
| 120 |
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
| 121 |
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
| 122 |
+
>(({ className, children, ...props }, ref) => (
|
| 123 |
+
<DropdownMenuPrimitive.RadioItem
|
| 124 |
+
ref={ref}
|
| 125 |
+
className={cn(
|
| 126 |
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 127 |
+
className
|
| 128 |
+
)}
|
| 129 |
+
{...props}
|
| 130 |
+
>
|
| 131 |
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
| 132 |
+
<DropdownMenuPrimitive.ItemIndicator>
|
| 133 |
+
<Circle className="h-2 w-2 fill-current" />
|
| 134 |
+
</DropdownMenuPrimitive.ItemIndicator>
|
| 135 |
+
</span>
|
| 136 |
+
{children}
|
| 137 |
+
</DropdownMenuPrimitive.RadioItem>
|
| 138 |
+
))
|
| 139 |
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
| 140 |
+
|
| 141 |
+
const DropdownMenuLabel = React.forwardRef<
|
| 142 |
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
| 143 |
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
| 144 |
+
inset?: boolean
|
| 145 |
+
}
|
| 146 |
+
>(({ className, inset, ...props }, ref) => (
|
| 147 |
+
<DropdownMenuPrimitive.Label
|
| 148 |
+
ref={ref}
|
| 149 |
+
className={cn(
|
| 150 |
+
"px-2 py-1.5 text-sm font-semibold",
|
| 151 |
+
inset && "pl-8",
|
| 152 |
+
className
|
| 153 |
+
)}
|
| 154 |
+
{...props}
|
| 155 |
+
/>
|
| 156 |
+
))
|
| 157 |
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
| 158 |
+
|
| 159 |
+
const DropdownMenuSeparator = React.forwardRef<
|
| 160 |
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
| 161 |
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
| 162 |
+
>(({ className, ...props }, ref) => (
|
| 163 |
+
<DropdownMenuPrimitive.Separator
|
| 164 |
+
ref={ref}
|
| 165 |
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
| 166 |
+
{...props}
|
| 167 |
+
/>
|
| 168 |
+
))
|
| 169 |
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
| 170 |
+
|
| 171 |
+
const DropdownMenuShortcut = ({
|
| 172 |
+
className,
|
| 173 |
+
...props
|
| 174 |
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
| 175 |
+
return (
|
| 176 |
+
<span
|
| 177 |
+
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
|
| 178 |
+
{...props}
|
| 179 |
+
/>
|
| 180 |
+
)
|
| 181 |
+
}
|
| 182 |
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
|
| 183 |
+
|
| 184 |
+
export {
|
| 185 |
+
DropdownMenu,
|
| 186 |
+
DropdownMenuTrigger,
|
| 187 |
+
DropdownMenuContent,
|
| 188 |
+
DropdownMenuItem,
|
| 189 |
+
DropdownMenuCheckboxItem,
|
| 190 |
+
DropdownMenuRadioItem,
|
| 191 |
+
DropdownMenuLabel,
|
| 192 |
+
DropdownMenuSeparator,
|
| 193 |
+
DropdownMenuShortcut,
|
| 194 |
+
DropdownMenuGroup,
|
| 195 |
+
DropdownMenuPortal,
|
| 196 |
+
DropdownMenuSub,
|
| 197 |
+
DropdownMenuSubContent,
|
| 198 |
+
DropdownMenuSubTrigger,
|
| 199 |
+
DropdownMenuRadioGroup,
|
| 200 |
+
}
|
src/components/ui/form.tsx
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as LabelPrimitive from "@radix-ui/react-label"
|
| 5 |
+
import { Slot } from "@radix-ui/react-slot"
|
| 6 |
+
import {
|
| 7 |
+
Controller,
|
| 8 |
+
FormProvider,
|
| 9 |
+
useFormContext,
|
| 10 |
+
type ControllerProps,
|
| 11 |
+
type FieldPath,
|
| 12 |
+
type FieldValues,
|
| 13 |
+
} from "react-hook-form"
|
| 14 |
+
|
| 15 |
+
import { cn } from "@/lib/utils"
|
| 16 |
+
import { Label } from "@/components/ui/label"
|
| 17 |
+
|
| 18 |
+
const Form = FormProvider
|
| 19 |
+
|
| 20 |
+
type FormFieldContextValue<
|
| 21 |
+
TFieldValues extends FieldValues = FieldValues,
|
| 22 |
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
|
| 23 |
+
> = {
|
| 24 |
+
name: TName
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
| 28 |
+
{} as FormFieldContextValue
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
const FormField = <
|
| 32 |
+
TFieldValues extends FieldValues = FieldValues,
|
| 33 |
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
|
| 34 |
+
>({
|
| 35 |
+
...props
|
| 36 |
+
}: ControllerProps<TFieldValues, TName>) => {
|
| 37 |
+
return (
|
| 38 |
+
<FormFieldContext.Provider value={{ name: props.name }}>
|
| 39 |
+
<Controller {...props} />
|
| 40 |
+
</FormFieldContext.Provider>
|
| 41 |
+
)
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
const useFormField = () => {
|
| 45 |
+
const fieldContext = React.useContext(FormFieldContext)
|
| 46 |
+
const itemContext = React.useContext(FormItemContext)
|
| 47 |
+
const { getFieldState, formState } = useFormContext()
|
| 48 |
+
|
| 49 |
+
const fieldState = getFieldState(fieldContext.name, formState)
|
| 50 |
+
|
| 51 |
+
if (!fieldContext) {
|
| 52 |
+
throw new Error("useFormField should be used within <FormField>")
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
const { id } = itemContext
|
| 56 |
+
|
| 57 |
+
return {
|
| 58 |
+
id,
|
| 59 |
+
name: fieldContext.name,
|
| 60 |
+
formItemId: `${id}-form-item`,
|
| 61 |
+
formDescriptionId: `${id}-form-item-description`,
|
| 62 |
+
formMessageId: `${id}-form-item-message`,
|
| 63 |
+
...fieldState,
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
type FormItemContextValue = {
|
| 68 |
+
id: string
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
const FormItemContext = React.createContext<FormItemContextValue>(
|
| 72 |
+
{} as FormItemContextValue
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
const FormItem = React.forwardRef<
|
| 76 |
+
HTMLDivElement,
|
| 77 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 78 |
+
>(({ className, ...props }, ref) => {
|
| 79 |
+
const id = React.useId()
|
| 80 |
+
|
| 81 |
+
return (
|
| 82 |
+
<FormItemContext.Provider value={{ id }}>
|
| 83 |
+
<div ref={ref} className={cn("space-y-2", className)} {...props} />
|
| 84 |
+
</FormItemContext.Provider>
|
| 85 |
+
)
|
| 86 |
+
})
|
| 87 |
+
FormItem.displayName = "FormItem"
|
| 88 |
+
|
| 89 |
+
const FormLabel = React.forwardRef<
|
| 90 |
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
| 91 |
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
|
| 92 |
+
>(({ className, ...props }, ref) => {
|
| 93 |
+
const { error, formItemId } = useFormField()
|
| 94 |
+
|
| 95 |
+
return (
|
| 96 |
+
<Label
|
| 97 |
+
ref={ref}
|
| 98 |
+
className={cn(error && "text-destructive", className)}
|
| 99 |
+
htmlFor={formItemId}
|
| 100 |
+
{...props}
|
| 101 |
+
/>
|
| 102 |
+
)
|
| 103 |
+
})
|
| 104 |
+
FormLabel.displayName = "FormLabel"
|
| 105 |
+
|
| 106 |
+
const FormControl = React.forwardRef<
|
| 107 |
+
React.ElementRef<typeof Slot>,
|
| 108 |
+
React.ComponentPropsWithoutRef<typeof Slot>
|
| 109 |
+
>(({ ...props }, ref) => {
|
| 110 |
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
| 111 |
+
|
| 112 |
+
return (
|
| 113 |
+
<Slot
|
| 114 |
+
ref={ref}
|
| 115 |
+
id={formItemId}
|
| 116 |
+
aria-describedby={
|
| 117 |
+
!error
|
| 118 |
+
? `${formDescriptionId}`
|
| 119 |
+
: `${formDescriptionId} ${formMessageId}`
|
| 120 |
+
}
|
| 121 |
+
aria-invalid={!!error}
|
| 122 |
+
{...props}
|
| 123 |
+
/>
|
| 124 |
+
)
|
| 125 |
+
})
|
| 126 |
+
FormControl.displayName = "FormControl"
|
| 127 |
+
|
| 128 |
+
const FormDescription = React.forwardRef<
|
| 129 |
+
HTMLParagraphElement,
|
| 130 |
+
React.HTMLAttributes<HTMLParagraphElement>
|
| 131 |
+
>(({ className, ...props }, ref) => {
|
| 132 |
+
const { formDescriptionId } = useFormField()
|
| 133 |
+
|
| 134 |
+
return (
|
| 135 |
+
<p
|
| 136 |
+
ref={ref}
|
| 137 |
+
id={formDescriptionId}
|
| 138 |
+
className={cn("text-sm text-muted-foreground", className)}
|
| 139 |
+
{...props}
|
| 140 |
+
/>
|
| 141 |
+
)
|
| 142 |
+
})
|
| 143 |
+
FormDescription.displayName = "FormDescription"
|
| 144 |
+
|
| 145 |
+
const FormMessage = React.forwardRef<
|
| 146 |
+
HTMLParagraphElement,
|
| 147 |
+
React.HTMLAttributes<HTMLParagraphElement>
|
| 148 |
+
>(({ className, children, ...props }, ref) => {
|
| 149 |
+
const { error, formMessageId } = useFormField()
|
| 150 |
+
const body = error ? String(error?.message ?? "") : children
|
| 151 |
+
|
| 152 |
+
if (!body) {
|
| 153 |
+
return null
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
return (
|
| 157 |
+
<p
|
| 158 |
+
ref={ref}
|
| 159 |
+
id={formMessageId}
|
| 160 |
+
className={cn("text-sm font-medium text-destructive", className)}
|
| 161 |
+
{...props}
|
| 162 |
+
>
|
| 163 |
+
{body}
|
| 164 |
+
</p>
|
| 165 |
+
)
|
| 166 |
+
})
|
| 167 |
+
FormMessage.displayName = "FormMessage"
|
| 168 |
+
|
| 169 |
+
export {
|
| 170 |
+
useFormField,
|
| 171 |
+
Form,
|
| 172 |
+
FormItem,
|
| 173 |
+
FormLabel,
|
| 174 |
+
FormControl,
|
| 175 |
+
FormDescription,
|
| 176 |
+
FormMessage,
|
| 177 |
+
FormField,
|
| 178 |
+
}
|
src/components/ui/input.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
|
| 3 |
+
import { cn } from "@/lib/utils"
|
| 4 |
+
|
| 5 |
+
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
|
| 6 |
+
({ className, type, ...props }, ref) => {
|
| 7 |
+
return (
|
| 8 |
+
<input
|
| 9 |
+
type={type}
|
| 10 |
+
className={cn(
|
| 11 |
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
| 12 |
+
className
|
| 13 |
+
)}
|
| 14 |
+
ref={ref}
|
| 15 |
+
{...props}
|
| 16 |
+
/>
|
| 17 |
+
)
|
| 18 |
+
}
|
| 19 |
+
)
|
| 20 |
+
Input.displayName = "Input"
|
| 21 |
+
|
| 22 |
+
export { Input }
|
src/components/ui/label.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as LabelPrimitive from "@radix-ui/react-label"
|
| 5 |
+
import { cva, type VariantProps } from "class-variance-authority"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const labelVariants = cva(
|
| 10 |
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
const Label = React.forwardRef<
|
| 14 |
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
| 15 |
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
|
| 16 |
+
VariantProps<typeof labelVariants>
|
| 17 |
+
>(({ className, ...props }, ref) => (
|
| 18 |
+
<LabelPrimitive.Root
|
| 19 |
+
ref={ref}
|
| 20 |
+
className={cn(labelVariants(), className)}
|
| 21 |
+
{...props}
|
| 22 |
+
/>
|
| 23 |
+
))
|
| 24 |
+
Label.displayName = LabelPrimitive.Root.displayName
|
| 25 |
+
|
| 26 |
+
export { Label }
|
src/components/ui/menubar.tsx
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as MenubarPrimitive from "@radix-ui/react-menubar"
|
| 5 |
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
function MenubarMenu({
|
| 10 |
+
...props
|
| 11 |
+
}: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
|
| 12 |
+
return <MenubarPrimitive.Menu {...props} />
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
function MenubarGroup({
|
| 16 |
+
...props
|
| 17 |
+
}: React.ComponentProps<typeof MenubarPrimitive.Group>) {
|
| 18 |
+
return <MenubarPrimitive.Group {...props} />
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
function MenubarPortal({
|
| 22 |
+
...props
|
| 23 |
+
}: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
|
| 24 |
+
return <MenubarPrimitive.Portal {...props} />
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
function MenubarRadioGroup({
|
| 28 |
+
...props
|
| 29 |
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
|
| 30 |
+
return <MenubarPrimitive.RadioGroup {...props} />
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
function MenubarSub({
|
| 34 |
+
...props
|
| 35 |
+
}: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
|
| 36 |
+
return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
const Menubar = React.forwardRef<
|
| 40 |
+
React.ElementRef<typeof MenubarPrimitive.Root>,
|
| 41 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
|
| 42 |
+
>(({ className, ...props }, ref) => (
|
| 43 |
+
<MenubarPrimitive.Root
|
| 44 |
+
ref={ref}
|
| 45 |
+
className={cn(
|
| 46 |
+
"flex h-10 items-center space-x-1 rounded-md border bg-background p-1",
|
| 47 |
+
className
|
| 48 |
+
)}
|
| 49 |
+
{...props}
|
| 50 |
+
/>
|
| 51 |
+
))
|
| 52 |
+
Menubar.displayName = MenubarPrimitive.Root.displayName
|
| 53 |
+
|
| 54 |
+
const MenubarTrigger = React.forwardRef<
|
| 55 |
+
React.ElementRef<typeof MenubarPrimitive.Trigger>,
|
| 56 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
|
| 57 |
+
>(({ className, ...props }, ref) => (
|
| 58 |
+
<MenubarPrimitive.Trigger
|
| 59 |
+
ref={ref}
|
| 60 |
+
className={cn(
|
| 61 |
+
"flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
| 62 |
+
className
|
| 63 |
+
)}
|
| 64 |
+
{...props}
|
| 65 |
+
/>
|
| 66 |
+
))
|
| 67 |
+
MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName
|
| 68 |
+
|
| 69 |
+
const MenubarSubTrigger = React.forwardRef<
|
| 70 |
+
React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
|
| 71 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
|
| 72 |
+
inset?: boolean
|
| 73 |
+
}
|
| 74 |
+
>(({ className, inset, children, ...props }, ref) => (
|
| 75 |
+
<MenubarPrimitive.SubTrigger
|
| 76 |
+
ref={ref}
|
| 77 |
+
className={cn(
|
| 78 |
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
| 79 |
+
inset && "pl-8",
|
| 80 |
+
className
|
| 81 |
+
)}
|
| 82 |
+
{...props}
|
| 83 |
+
>
|
| 84 |
+
{children}
|
| 85 |
+
<ChevronRight className="ml-auto h-4 w-4" />
|
| 86 |
+
</MenubarPrimitive.SubTrigger>
|
| 87 |
+
))
|
| 88 |
+
MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName
|
| 89 |
+
|
| 90 |
+
const MenubarSubContent = React.forwardRef<
|
| 91 |
+
React.ElementRef<typeof MenubarPrimitive.SubContent>,
|
| 92 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
|
| 93 |
+
>(({ className, ...props }, ref) => (
|
| 94 |
+
<MenubarPrimitive.SubContent
|
| 95 |
+
ref={ref}
|
| 96 |
+
className={cn(
|
| 97 |
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
| 98 |
+
className
|
| 99 |
+
)}
|
| 100 |
+
{...props}
|
| 101 |
+
/>
|
| 102 |
+
))
|
| 103 |
+
MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName
|
| 104 |
+
|
| 105 |
+
const MenubarContent = React.forwardRef<
|
| 106 |
+
React.ElementRef<typeof MenubarPrimitive.Content>,
|
| 107 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
|
| 108 |
+
>(
|
| 109 |
+
(
|
| 110 |
+
{ className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
|
| 111 |
+
ref
|
| 112 |
+
) => (
|
| 113 |
+
<MenubarPrimitive.Portal>
|
| 114 |
+
<MenubarPrimitive.Content
|
| 115 |
+
ref={ref}
|
| 116 |
+
align={align}
|
| 117 |
+
alignOffset={alignOffset}
|
| 118 |
+
sideOffset={sideOffset}
|
| 119 |
+
className={cn(
|
| 120 |
+
"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
| 121 |
+
className
|
| 122 |
+
)}
|
| 123 |
+
{...props}
|
| 124 |
+
/>
|
| 125 |
+
</MenubarPrimitive.Portal>
|
| 126 |
+
)
|
| 127 |
+
)
|
| 128 |
+
MenubarContent.displayName = MenubarPrimitive.Content.displayName
|
| 129 |
+
|
| 130 |
+
const MenubarItem = React.forwardRef<
|
| 131 |
+
React.ElementRef<typeof MenubarPrimitive.Item>,
|
| 132 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
|
| 133 |
+
inset?: boolean
|
| 134 |
+
}
|
| 135 |
+
>(({ className, inset, ...props }, ref) => (
|
| 136 |
+
<MenubarPrimitive.Item
|
| 137 |
+
ref={ref}
|
| 138 |
+
className={cn(
|
| 139 |
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 140 |
+
inset && "pl-8",
|
| 141 |
+
className
|
| 142 |
+
)}
|
| 143 |
+
{...props}
|
| 144 |
+
/>
|
| 145 |
+
))
|
| 146 |
+
MenubarItem.displayName = MenubarPrimitive.Item.displayName
|
| 147 |
+
|
| 148 |
+
const MenubarCheckboxItem = React.forwardRef<
|
| 149 |
+
React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
|
| 150 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
|
| 151 |
+
>(({ className, children, checked, ...props }, ref) => (
|
| 152 |
+
<MenubarPrimitive.CheckboxItem
|
| 153 |
+
ref={ref}
|
| 154 |
+
className={cn(
|
| 155 |
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 156 |
+
className
|
| 157 |
+
)}
|
| 158 |
+
checked={checked}
|
| 159 |
+
{...props}
|
| 160 |
+
>
|
| 161 |
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
| 162 |
+
<MenubarPrimitive.ItemIndicator>
|
| 163 |
+
<Check className="h-4 w-4" />
|
| 164 |
+
</MenubarPrimitive.ItemIndicator>
|
| 165 |
+
</span>
|
| 166 |
+
{children}
|
| 167 |
+
</MenubarPrimitive.CheckboxItem>
|
| 168 |
+
))
|
| 169 |
+
MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName
|
| 170 |
+
|
| 171 |
+
const MenubarRadioItem = React.forwardRef<
|
| 172 |
+
React.ElementRef<typeof MenubarPrimitive.RadioItem>,
|
| 173 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
|
| 174 |
+
>(({ className, children, ...props }, ref) => (
|
| 175 |
+
<MenubarPrimitive.RadioItem
|
| 176 |
+
ref={ref}
|
| 177 |
+
className={cn(
|
| 178 |
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 179 |
+
className
|
| 180 |
+
)}
|
| 181 |
+
{...props}
|
| 182 |
+
>
|
| 183 |
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
| 184 |
+
<MenubarPrimitive.ItemIndicator>
|
| 185 |
+
<Circle className="h-2 w-2 fill-current" />
|
| 186 |
+
</MenubarPrimitive.ItemIndicator>
|
| 187 |
+
</span>
|
| 188 |
+
{children}
|
| 189 |
+
</MenubarPrimitive.RadioItem>
|
| 190 |
+
))
|
| 191 |
+
MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName
|
| 192 |
+
|
| 193 |
+
const MenubarLabel = React.forwardRef<
|
| 194 |
+
React.ElementRef<typeof MenubarPrimitive.Label>,
|
| 195 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
|
| 196 |
+
inset?: boolean
|
| 197 |
+
}
|
| 198 |
+
>(({ className, inset, ...props }, ref) => (
|
| 199 |
+
<MenubarPrimitive.Label
|
| 200 |
+
ref={ref}
|
| 201 |
+
className={cn(
|
| 202 |
+
"px-2 py-1.5 text-sm font-semibold",
|
| 203 |
+
inset && "pl-8",
|
| 204 |
+
className
|
| 205 |
+
)}
|
| 206 |
+
{...props}
|
| 207 |
+
/>
|
| 208 |
+
))
|
| 209 |
+
MenubarLabel.displayName = MenubarPrimitive.Label.displayName
|
| 210 |
+
|
| 211 |
+
const MenubarSeparator = React.forwardRef<
|
| 212 |
+
React.ElementRef<typeof MenubarPrimitive.Separator>,
|
| 213 |
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
|
| 214 |
+
>(({ className, ...props }, ref) => (
|
| 215 |
+
<MenubarPrimitive.Separator
|
| 216 |
+
ref={ref}
|
| 217 |
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
| 218 |
+
{...props}
|
| 219 |
+
/>
|
| 220 |
+
))
|
| 221 |
+
MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName
|
| 222 |
+
|
| 223 |
+
const MenubarShortcut = ({
|
| 224 |
+
className,
|
| 225 |
+
...props
|
| 226 |
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
| 227 |
+
return (
|
| 228 |
+
<span
|
| 229 |
+
className={cn(
|
| 230 |
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
| 231 |
+
className
|
| 232 |
+
)}
|
| 233 |
+
{...props}
|
| 234 |
+
/>
|
| 235 |
+
)
|
| 236 |
+
}
|
| 237 |
+
MenubarShortcut.displayname = "MenubarShortcut"
|
| 238 |
+
|
| 239 |
+
export {
|
| 240 |
+
Menubar,
|
| 241 |
+
MenubarMenu,
|
| 242 |
+
MenubarTrigger,
|
| 243 |
+
MenubarContent,
|
| 244 |
+
MenubarItem,
|
| 245 |
+
MenubarSeparator,
|
| 246 |
+
MenubarLabel,
|
| 247 |
+
MenubarCheckboxItem,
|
| 248 |
+
MenubarRadioGroup,
|
| 249 |
+
MenubarRadioItem,
|
| 250 |
+
MenubarPortal,
|
| 251 |
+
MenubarSubContent,
|
| 252 |
+
MenubarSubTrigger,
|
| 253 |
+
MenubarGroup,
|
| 254 |
+
MenubarSub,
|
| 255 |
+
MenubarShortcut,
|
| 256 |
+
}
|
src/components/ui/popover.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as PopoverPrimitive from "@radix-ui/react-popover"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
|
| 8 |
+
const Popover = PopoverPrimitive.Root
|
| 9 |
+
|
| 10 |
+
const PopoverTrigger = PopoverPrimitive.Trigger
|
| 11 |
+
|
| 12 |
+
const PopoverContent = React.forwardRef<
|
| 13 |
+
React.ElementRef<typeof PopoverPrimitive.Content>,
|
| 14 |
+
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
|
| 15 |
+
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
|
| 16 |
+
<PopoverPrimitive.Portal>
|
| 17 |
+
<PopoverPrimitive.Content
|
| 18 |
+
ref={ref}
|
| 19 |
+
align={align}
|
| 20 |
+
sideOffset={sideOffset}
|
| 21 |
+
className={cn(
|
| 22 |
+
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
| 23 |
+
className
|
| 24 |
+
)}
|
| 25 |
+
{...props}
|
| 26 |
+
/>
|
| 27 |
+
</PopoverPrimitive.Portal>
|
| 28 |
+
))
|
| 29 |
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName
|
| 30 |
+
|
| 31 |
+
export { Popover, PopoverTrigger, PopoverContent }
|
src/components/ui/progress.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as ProgressPrimitive from "@radix-ui/react-progress"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
|
| 8 |
+
const Progress = React.forwardRef<
|
| 9 |
+
React.ElementRef<typeof ProgressPrimitive.Root>,
|
| 10 |
+
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
| 11 |
+
>(({ className, value, ...props }, ref) => (
|
| 12 |
+
<ProgressPrimitive.Root
|
| 13 |
+
ref={ref}
|
| 14 |
+
className={cn(
|
| 15 |
+
"relative h-4 w-full overflow-hidden rounded-full bg-secondary",
|
| 16 |
+
className
|
| 17 |
+
)}
|
| 18 |
+
{...props}
|
| 19 |
+
>
|
| 20 |
+
<ProgressPrimitive.Indicator
|
| 21 |
+
className="h-full w-full flex-1 bg-primary transition-all"
|
| 22 |
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
| 23 |
+
/>
|
| 24 |
+
</ProgressPrimitive.Root>
|
| 25 |
+
))
|
| 26 |
+
Progress.displayName = ProgressPrimitive.Root.displayName
|
| 27 |
+
|
| 28 |
+
export { Progress }
|
src/components/ui/radio-group.tsx
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
| 5 |
+
import { Circle } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const RadioGroup = React.forwardRef<
|
| 10 |
+
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
| 11 |
+
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
|
| 12 |
+
>(({ className, ...props }, ref) => {
|
| 13 |
+
return (
|
| 14 |
+
<RadioGroupPrimitive.Root
|
| 15 |
+
className={cn("grid gap-2", className)}
|
| 16 |
+
{...props}
|
| 17 |
+
ref={ref}
|
| 18 |
+
/>
|
| 19 |
+
)
|
| 20 |
+
})
|
| 21 |
+
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
|
| 22 |
+
|
| 23 |
+
const RadioGroupItem = React.forwardRef<
|
| 24 |
+
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
| 25 |
+
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
|
| 26 |
+
>(({ className, ...props }, ref) => {
|
| 27 |
+
return (
|
| 28 |
+
<RadioGroupPrimitive.Item
|
| 29 |
+
ref={ref}
|
| 30 |
+
className={cn(
|
| 31 |
+
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
| 32 |
+
className
|
| 33 |
+
)}
|
| 34 |
+
{...props}
|
| 35 |
+
>
|
| 36 |
+
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
| 37 |
+
<Circle className="h-2.5 w-2.5 fill-current text-current" />
|
| 38 |
+
</RadioGroupPrimitive.Indicator>
|
| 39 |
+
</RadioGroupPrimitive.Item>
|
| 40 |
+
)
|
| 41 |
+
})
|
| 42 |
+
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
|
| 43 |
+
|
| 44 |
+
export { RadioGroup, RadioGroupItem }
|
src/components/ui/scroll-area.tsx
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
|
| 8 |
+
const ScrollArea = React.forwardRef<
|
| 9 |
+
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
| 10 |
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
| 11 |
+
>(({ className, children, ...props }, ref) => (
|
| 12 |
+
<ScrollAreaPrimitive.Root
|
| 13 |
+
ref={ref}
|
| 14 |
+
className={cn("relative overflow-hidden", className)}
|
| 15 |
+
{...props}
|
| 16 |
+
>
|
| 17 |
+
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
|
| 18 |
+
{children}
|
| 19 |
+
</ScrollAreaPrimitive.Viewport>
|
| 20 |
+
<ScrollBar />
|
| 21 |
+
<ScrollAreaPrimitive.Corner />
|
| 22 |
+
</ScrollAreaPrimitive.Root>
|
| 23 |
+
))
|
| 24 |
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
|
| 25 |
+
|
| 26 |
+
const ScrollBar = React.forwardRef<
|
| 27 |
+
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
| 28 |
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
| 29 |
+
>(({ className, orientation = "vertical", ...props }, ref) => (
|
| 30 |
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
| 31 |
+
ref={ref}
|
| 32 |
+
orientation={orientation}
|
| 33 |
+
className={cn(
|
| 34 |
+
"flex touch-none select-none transition-colors",
|
| 35 |
+
orientation === "vertical" &&
|
| 36 |
+
"h-full w-2.5 border-l border-l-transparent p-[1px]",
|
| 37 |
+
orientation === "horizontal" &&
|
| 38 |
+
"h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
| 39 |
+
className
|
| 40 |
+
)}
|
| 41 |
+
{...props}
|
| 42 |
+
>
|
| 43 |
+
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
| 44 |
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
| 45 |
+
))
|
| 46 |
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
|
| 47 |
+
|
| 48 |
+
export { ScrollArea, ScrollBar }
|
src/components/ui/select.tsx
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as SelectPrimitive from "@radix-ui/react-select"
|
| 5 |
+
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const Select = SelectPrimitive.Root
|
| 10 |
+
|
| 11 |
+
const SelectGroup = SelectPrimitive.Group
|
| 12 |
+
|
| 13 |
+
const SelectValue = SelectPrimitive.Value
|
| 14 |
+
|
| 15 |
+
const SelectTrigger = React.forwardRef<
|
| 16 |
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
| 17 |
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
| 18 |
+
>(({ className, children, ...props }, ref) => (
|
| 19 |
+
<SelectPrimitive.Trigger
|
| 20 |
+
ref={ref}
|
| 21 |
+
className={cn(
|
| 22 |
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
| 23 |
+
className
|
| 24 |
+
)}
|
| 25 |
+
{...props}
|
| 26 |
+
>
|
| 27 |
+
{children}
|
| 28 |
+
<SelectPrimitive.Icon asChild>
|
| 29 |
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
| 30 |
+
</SelectPrimitive.Icon>
|
| 31 |
+
</SelectPrimitive.Trigger>
|
| 32 |
+
))
|
| 33 |
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
| 34 |
+
|
| 35 |
+
const SelectScrollUpButton = React.forwardRef<
|
| 36 |
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
| 37 |
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
| 38 |
+
>(({ className, ...props }, ref) => (
|
| 39 |
+
<SelectPrimitive.ScrollUpButton
|
| 40 |
+
ref={ref}
|
| 41 |
+
className={cn(
|
| 42 |
+
"flex cursor-default items-center justify-center py-1",
|
| 43 |
+
className
|
| 44 |
+
)}
|
| 45 |
+
{...props}
|
| 46 |
+
>
|
| 47 |
+
<ChevronUp className="h-4 w-4" />
|
| 48 |
+
</SelectPrimitive.ScrollUpButton>
|
| 49 |
+
))
|
| 50 |
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
| 51 |
+
|
| 52 |
+
const SelectScrollDownButton = React.forwardRef<
|
| 53 |
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
| 54 |
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
| 55 |
+
>(({ className, ...props }, ref) => (
|
| 56 |
+
<SelectPrimitive.ScrollDownButton
|
| 57 |
+
ref={ref}
|
| 58 |
+
className={cn(
|
| 59 |
+
"flex cursor-default items-center justify-center py-1",
|
| 60 |
+
className
|
| 61 |
+
)}
|
| 62 |
+
{...props}
|
| 63 |
+
>
|
| 64 |
+
<ChevronDown className="h-4 w-4" />
|
| 65 |
+
</SelectPrimitive.ScrollDownButton>
|
| 66 |
+
))
|
| 67 |
+
SelectScrollDownButton.displayName =
|
| 68 |
+
SelectPrimitive.ScrollDownButton.displayName
|
| 69 |
+
|
| 70 |
+
const SelectContent = React.forwardRef<
|
| 71 |
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
| 72 |
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
| 73 |
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
| 74 |
+
<SelectPrimitive.Portal>
|
| 75 |
+
<SelectPrimitive.Content
|
| 76 |
+
ref={ref}
|
| 77 |
+
className={cn(
|
| 78 |
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
| 79 |
+
position === "popper" &&
|
| 80 |
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
| 81 |
+
className
|
| 82 |
+
)}
|
| 83 |
+
position={position}
|
| 84 |
+
{...props}
|
| 85 |
+
>
|
| 86 |
+
<SelectScrollUpButton />
|
| 87 |
+
<SelectPrimitive.Viewport
|
| 88 |
+
className={cn(
|
| 89 |
+
"p-1",
|
| 90 |
+
position === "popper" &&
|
| 91 |
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
| 92 |
+
)}
|
| 93 |
+
>
|
| 94 |
+
{children}
|
| 95 |
+
</SelectPrimitive.Viewport>
|
| 96 |
+
<SelectScrollDownButton />
|
| 97 |
+
</SelectPrimitive.Content>
|
| 98 |
+
</SelectPrimitive.Portal>
|
| 99 |
+
))
|
| 100 |
+
SelectContent.displayName = SelectPrimitive.Content.displayName
|
| 101 |
+
|
| 102 |
+
const SelectLabel = React.forwardRef<
|
| 103 |
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
| 104 |
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
| 105 |
+
>(({ className, ...props }, ref) => (
|
| 106 |
+
<SelectPrimitive.Label
|
| 107 |
+
ref={ref}
|
| 108 |
+
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
| 109 |
+
{...props}
|
| 110 |
+
/>
|
| 111 |
+
))
|
| 112 |
+
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
| 113 |
+
|
| 114 |
+
const SelectItem = React.forwardRef<
|
| 115 |
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
| 116 |
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
| 117 |
+
>(({ className, children, ...props }, ref) => (
|
| 118 |
+
<SelectPrimitive.Item
|
| 119 |
+
ref={ref}
|
| 120 |
+
className={cn(
|
| 121 |
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 122 |
+
className
|
| 123 |
+
)}
|
| 124 |
+
{...props}
|
| 125 |
+
>
|
| 126 |
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
| 127 |
+
<SelectPrimitive.ItemIndicator>
|
| 128 |
+
<Check className="h-4 w-4" />
|
| 129 |
+
</SelectPrimitive.ItemIndicator>
|
| 130 |
+
</span>
|
| 131 |
+
|
| 132 |
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
| 133 |
+
</SelectPrimitive.Item>
|
| 134 |
+
))
|
| 135 |
+
SelectItem.displayName = SelectPrimitive.Item.displayName
|
| 136 |
+
|
| 137 |
+
const SelectSeparator = React.forwardRef<
|
| 138 |
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
| 139 |
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
| 140 |
+
>(({ className, ...props }, ref) => (
|
| 141 |
+
<SelectPrimitive.Separator
|
| 142 |
+
ref={ref}
|
| 143 |
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
| 144 |
+
{...props}
|
| 145 |
+
/>
|
| 146 |
+
))
|
| 147 |
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
| 148 |
+
|
| 149 |
+
export {
|
| 150 |
+
Select,
|
| 151 |
+
SelectGroup,
|
| 152 |
+
SelectValue,
|
| 153 |
+
SelectTrigger,
|
| 154 |
+
SelectContent,
|
| 155 |
+
SelectLabel,
|
| 156 |
+
SelectItem,
|
| 157 |
+
SelectSeparator,
|
| 158 |
+
SelectScrollUpButton,
|
| 159 |
+
SelectScrollDownButton,
|
| 160 |
+
}
|
src/components/ui/separator.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
|
| 8 |
+
const Separator = React.forwardRef<
|
| 9 |
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
| 10 |
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
| 11 |
+
>(
|
| 12 |
+
(
|
| 13 |
+
{ className, orientation = "horizontal", decorative = true, ...props },
|
| 14 |
+
ref
|
| 15 |
+
) => (
|
| 16 |
+
<SeparatorPrimitive.Root
|
| 17 |
+
ref={ref}
|
| 18 |
+
decorative={decorative}
|
| 19 |
+
orientation={orientation}
|
| 20 |
+
className={cn(
|
| 21 |
+
"shrink-0 bg-border",
|
| 22 |
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
| 23 |
+
className
|
| 24 |
+
)}
|
| 25 |
+
{...props}
|
| 26 |
+
/>
|
| 27 |
+
)
|
| 28 |
+
)
|
| 29 |
+
Separator.displayName = SeparatorPrimitive.Root.displayName
|
| 30 |
+
|
| 31 |
+
export { Separator }
|