commit
bba6456e81
@ -0,0 +1,3 @@ |
||||
{ |
||||
"extends": "next/core-web-vitals" |
||||
} |
@ -0,0 +1,36 @@ |
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. |
||||
|
||||
# dependencies |
||||
/node_modules |
||||
/.pnp |
||||
.pnp.js |
||||
|
||||
# testing |
||||
/coverage |
||||
|
||||
# next.js |
||||
/.next/ |
||||
/out/ |
||||
|
||||
# production |
||||
/build |
||||
|
||||
# misc |
||||
.DS_Store |
||||
*.pem |
||||
|
||||
# debug |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
.pnpm-debug.log* |
||||
|
||||
# local env files |
||||
.env*.local |
||||
|
||||
# vercel |
||||
.vercel |
||||
|
||||
# typescript |
||||
*.tsbuildinfo |
||||
next-env.d.ts |
@ -0,0 +1,4 @@ |
||||
{ |
||||
"typescript.tsdk": "node_modules/typescript/lib", |
||||
"typescript.enablePromptUseWorkspaceTsdk": true |
||||
} |
@ -0,0 +1,38 @@ |
||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). |
||||
|
||||
## Getting Started |
||||
|
||||
First, run the development server: |
||||
|
||||
```bash |
||||
npm run dev |
||||
# or |
||||
yarn dev |
||||
# or |
||||
pnpm dev |
||||
``` |
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. |
||||
|
||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. |
||||
|
||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. |
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. |
||||
|
||||
## Learn More |
||||
|
||||
To learn more about Next.js, take a look at the following resources: |
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! |
||||
|
||||
## Deploy on Vercel |
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. |
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
@ -0,0 +1,8 @@ |
||||
/** @type {import('next').NextConfig} */ |
||||
const nextConfig = { |
||||
experimental: { |
||||
appDir: true, |
||||
}, |
||||
} |
||||
|
||||
module.exports = nextConfig |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@ |
||||
{ |
||||
"name": "diploma.krasnikov.pro", |
||||
"version": "0.1.0", |
||||
"private": true, |
||||
"scripts": { |
||||
"dev": "next dev", |
||||
"build": "next build", |
||||
"start": "next start", |
||||
"lint": "next lint" |
||||
}, |
||||
"dependencies": { |
||||
"@types/node": "18.14.6", |
||||
"@types/react": "18.0.28", |
||||
"@types/react-dom": "18.0.11", |
||||
"daisyui": "^2.51.3", |
||||
"eslint": "8.35.0", |
||||
"eslint-config-next": "13.2.3", |
||||
"jspdf": "^2.5.1", |
||||
"mysql2": "^3.2.0", |
||||
"next": "13.2.3", |
||||
"react": "18.2.0", |
||||
"react-dom": "18.2.0", |
||||
"typescript": "4.9.5" |
||||
}, |
||||
"devDependencies": { |
||||
"autoprefixer": "^10.4.13", |
||||
"postcss": "^8.4.21", |
||||
"tailwindcss": "^3.2.7" |
||||
} |
||||
} |
@ -0,0 +1,6 @@ |
||||
module.exports = { |
||||
plugins: { |
||||
tailwindcss: {}, |
||||
autoprefixer: {}, |
||||
}, |
||||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 560 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 629 B |
After Width: | Height: | Size: 25 KiB |
@ -0,0 +1,3 @@ |
||||
@tailwind base; |
||||
@tailwind components; |
||||
@tailwind utilities; |
@ -0,0 +1,18 @@ |
||||
import './globals.css' |
||||
|
||||
export const metadata = { |
||||
title: 'ОБРАЗОВАТЕЛЬНЫЙ ИНТЕНСИВ МедиаКот', |
||||
description: 'ОБРАЗОВАТЕЛЬНЫЙ ИНТЕНСИВ МедиаКот - Электронные сертификаты участникам', |
||||
} |
||||
|
||||
export default function RootLayout({ |
||||
children, |
||||
}: { |
||||
children: React.ReactNode |
||||
}) { |
||||
return ( |
||||
<html lang="ru"> |
||||
<body>{children}</body> |
||||
</html> |
||||
) |
||||
} |
@ -0,0 +1,271 @@ |
||||
.main { |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
padding: 5px; |
||||
min-height: 100vh; |
||||
} |
||||
|
||||
.description { |
||||
display: inherit; |
||||
justify-content: inherit; |
||||
align-items: inherit; |
||||
font-size: 0.85rem; |
||||
max-width: var(--max-width); |
||||
width: 100%; |
||||
z-index: 2; |
||||
font-family: var(--font-mono); |
||||
} |
||||
|
||||
.description a { |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
gap: 0.5rem; |
||||
} |
||||
|
||||
.description p { |
||||
position: relative; |
||||
margin: 0; |
||||
padding: 1rem; |
||||
background-color: rgba(var(--callout-rgb), 0.5); |
||||
border: 1px solid rgba(var(--callout-border-rgb), 0.3); |
||||
border-radius: var(--border-radius); |
||||
} |
||||
|
||||
.code { |
||||
font-weight: 700; |
||||
font-family: var(--font-mono); |
||||
} |
||||
|
||||
.grid { |
||||
display: grid; |
||||
grid-template-columns: repeat(3, minmax(33%, auto)); |
||||
width: var(--max-width); |
||||
max-width: 100%; |
||||
} |
||||
|
||||
.card { |
||||
padding: 1rem 1.2rem; |
||||
border-radius: var(--border-radius); |
||||
background: rgba(var(--card-rgb), 0); |
||||
border: 1px solid rgba(var(--card-border-rgb), 0); |
||||
transition: background 200ms, border 200ms; |
||||
} |
||||
|
||||
.card span { |
||||
display: inline-block; |
||||
transition: transform 200ms; |
||||
} |
||||
|
||||
.card h2 { |
||||
font-weight: 600; |
||||
margin-bottom: 0.7rem; |
||||
} |
||||
|
||||
.card p { |
||||
margin: 0; |
||||
opacity: 0.6; |
||||
font-size: 0.9rem; |
||||
line-height: 1.5; |
||||
max-width: 34ch; |
||||
} |
||||
|
||||
.center { |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
position: relative; |
||||
padding: 4rem 0; |
||||
} |
||||
|
||||
.center::before { |
||||
background: var(--secondary-glow); |
||||
border-radius: 50%; |
||||
width: 480px; |
||||
height: 360px; |
||||
margin-left: -400px; |
||||
} |
||||
|
||||
.center::after { |
||||
background: var(--primary-glow); |
||||
width: 240px; |
||||
height: 180px; |
||||
z-index: -1; |
||||
} |
||||
|
||||
.center::before, |
||||
.center::after { |
||||
content: ''; |
||||
left: 50%; |
||||
position: absolute; |
||||
filter: blur(45px); |
||||
transform: translateZ(0); |
||||
} |
||||
|
||||
.logo, |
||||
.thirteen { |
||||
position: relative; |
||||
} |
||||
|
||||
.thirteen { |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
width: 75px; |
||||
height: 75px; |
||||
padding: 25px 10px; |
||||
margin-left: 16px; |
||||
transform: translateZ(0); |
||||
border-radius: var(--border-radius); |
||||
overflow: hidden; |
||||
box-shadow: 0px 2px 8px -1px #0000001a; |
||||
} |
||||
|
||||
.thirteen::before, |
||||
.thirteen::after { |
||||
content: ''; |
||||
position: absolute; |
||||
z-index: -1; |
||||
} |
||||
|
||||
/* Conic Gradient Animation */ |
||||
.thirteen::before { |
||||
animation: 6s rotate linear infinite; |
||||
width: 200%; |
||||
height: 200%; |
||||
background: var(--tile-border); |
||||
} |
||||
|
||||
/* Inner Square */ |
||||
.thirteen::after { |
||||
inset: 0; |
||||
padding: 1px; |
||||
border-radius: var(--border-radius); |
||||
background: linear-gradient( |
||||
to bottom right, |
||||
rgba(var(--tile-start-rgb), 1), |
||||
rgba(var(--tile-end-rgb), 1) |
||||
); |
||||
background-clip: content-box; |
||||
} |
||||
|
||||
/* Enable hover only on non-touch devices */ |
||||
@media (hover: hover) and (pointer: fine) { |
||||
.card:hover { |
||||
background: rgba(var(--card-rgb), 0.1); |
||||
border: 1px solid rgba(var(--card-border-rgb), 0.15); |
||||
} |
||||
|
||||
.card:hover span { |
||||
transform: translateX(4px); |
||||
} |
||||
} |
||||
|
||||
@media (prefers-reduced-motion) { |
||||
.thirteen::before { |
||||
animation: none; |
||||
} |
||||
|
||||
.card:hover span { |
||||
transform: none; |
||||
} |
||||
} |
||||
|
||||
/* Mobile and Tablet */ |
||||
@media (max-width: 1023px) { |
||||
.content { |
||||
padding: 4rem; |
||||
} |
||||
|
||||
.grid { |
||||
grid-template-columns: 1fr; |
||||
margin-bottom: 120px; |
||||
max-width: 320px; |
||||
text-align: center; |
||||
} |
||||
|
||||
.card { |
||||
padding: 1rem 2.5rem; |
||||
} |
||||
|
||||
.card h2 { |
||||
margin-bottom: 0.5rem; |
||||
} |
||||
|
||||
.center { |
||||
padding: 8rem 0 6rem; |
||||
} |
||||
|
||||
.center::before { |
||||
transform: none; |
||||
height: 300px; |
||||
} |
||||
|
||||
.description { |
||||
font-size: 0.8rem; |
||||
} |
||||
|
||||
.description a { |
||||
padding: 1rem; |
||||
} |
||||
|
||||
.description p, |
||||
.description div { |
||||
display: flex; |
||||
justify-content: center; |
||||
position: fixed; |
||||
width: 100%; |
||||
} |
||||
|
||||
.description p { |
||||
align-items: center; |
||||
inset: 0 0 auto; |
||||
padding: 2rem 1rem 1.4rem; |
||||
border-radius: 0; |
||||
border: none; |
||||
border-bottom: 1px solid rgba(var(--callout-border-rgb), 0.25); |
||||
background: linear-gradient( |
||||
to bottom, |
||||
rgba(var(--background-start-rgb), 1), |
||||
rgba(var(--callout-rgb), 0.5) |
||||
); |
||||
background-clip: padding-box; |
||||
backdrop-filter: blur(24px); |
||||
} |
||||
|
||||
.description div { |
||||
align-items: flex-end; |
||||
pointer-events: none; |
||||
inset: auto 0 0; |
||||
padding: 2rem; |
||||
height: 200px; |
||||
background: linear-gradient( |
||||
to bottom, |
||||
transparent 0%, |
||||
rgb(var(--background-end-rgb)) 40% |
||||
); |
||||
z-index: 1; |
||||
} |
||||
} |
||||
|
||||
@media (prefers-color-scheme: dark) { |
||||
.vercelLogo { |
||||
filter: invert(1); |
||||
} |
||||
|
||||
.logo, |
||||
.thirteen img { |
||||
filter: invert(1) drop-shadow(0 0 0.3rem #ffffff70); |
||||
} |
||||
} |
||||
|
||||
@keyframes rotate { |
||||
from { |
||||
transform: rotate(360deg); |
||||
} |
||||
to { |
||||
transform: rotate(0deg); |
||||
} |
||||
} |
@ -0,0 +1,78 @@ |
||||
'use client'; |
||||
|
||||
import styles from './page.module.css' |
||||
import React, {useState, useEffect} from 'react'; |
||||
import { jsPDF } from "jspdf"; |
||||
|
||||
|
||||
|
||||
export default function Home() { |
||||
type User = { |
||||
fio: string, |
||||
} |
||||
const [rows, setRows] = useState<User[]>([]); |
||||
|
||||
useEffect(() => { |
||||
async function getData() { |
||||
const actualData = await fetch('api/load') |
||||
.then(response => response.json()); |
||||
setRows(actualData); |
||||
} |
||||
getData() |
||||
}, []) |
||||
|
||||
|
||||
const print = (e: any) => { |
||||
const key = e.target.value; |
||||
|
||||
var pdf = new jsPDF("landscape");; |
||||
pdf.addFont("/PT_Sans/PTSans-Regular.ttf", "PTSans", "normal"); |
||||
pdf.setFont("PTSans"); // set font
|
||||
|
||||
pdf.setFontSize(33); |
||||
pdf.addImage("/sert.png", "JPEG", 0, 0, 297, 210); |
||||
pdf.text(rows[key].fio, 60, 117); |
||||
|
||||
pdf.save(rows[key].fio+"_МедиаКОТ"+".pdf"); |
||||
} |
||||
|
||||
return ( |
||||
<> |
||||
<div className="navbar bg-base-100"> |
||||
<a className="btn btn-ghost normal-case text-xl">ОБРАЗОВАТЕЛЬНЫЙ ИНТЕНСИВ МедиаКот</a> |
||||
</div> |
||||
<main className={styles.main}> |
||||
<div className="card lg:card-side bg-base-100 shadow-xl"> |
||||
<div className="overflow-x-auto"> |
||||
<table className="table table-zebra w-full"> |
||||
<thead> |
||||
<tr> |
||||
<th></th> |
||||
<th>ФИО</th> |
||||
<th>Сертификат</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{rows.map((row, key) => ( |
||||
<tr key={key}> |
||||
<th>{key+1}</th> |
||||
<td>{row.fio}</td> |
||||
<td> |
||||
<button
|
||||
className="btn btn-accent"
|
||||
value={key} |
||||
onClick={(e) => print(e)} |
||||
> |
||||
Скачать |
||||
</button> |
||||
</td> |
||||
</tr> |
||||
))}
|
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
</> |
||||
) |
||||
} |
@ -0,0 +1,14 @@ |
||||
import mysql from "mysql2"; |
||||
|
||||
const pool = mysql.createPool({ |
||||
host: process.env.HOST, |
||||
user: process.env.DATABASE, |
||||
database: process.env.DATABASE, |
||||
password: process.env.PASSWORD, |
||||
waitForConnections: true, |
||||
connectionLimit: 10, |
||||
queueLimit: 0 |
||||
}); |
||||
|
||||
console.log(pool); |
||||
module.exports = pool; |
@ -0,0 +1,12 @@ |
||||
var pool = require("./connect"); |
||||
import {QueryError} from 'mysql2'; |
||||
|
||||
interface definitionInterface{ |
||||
(message:string):void; |
||||
} |
||||
export default function Select(sql: string, callback: definitionInterface) { |
||||
pool.query(sql, (err: QueryError, rows: string) => { |
||||
callback(rows); |
||||
pool.releaseConnection(pool); |
||||
}); |
||||
} |
@ -0,0 +1,15 @@ |
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
import type { NextApiRequest, NextApiResponse } from 'next' |
||||
|
||||
import Select from "../../db/select"; |
||||
|
||||
const sql = "SELECT id, fio FROM user WHERE status=1 ORDER BY user.fio ASC"; |
||||
|
||||
export default function handler( |
||||
req: NextApiRequest, |
||||
res: NextApiResponse) { |
||||
Select(sql, function(data){ |
||||
res.status(200).json(data); |
||||
}) |
||||
} |
||||
|
@ -0,0 +1,15 @@ |
||||
/** @type {import('tailwindcss').Config} */ |
||||
module.exports = { |
||||
content: [ |
||||
"./src/app/**/*.{js,ts,jsx,tsx}", |
||||
"./pages/**/*.{js,ts,jsx,tsx}", |
||||
"./components/**/*.{js,ts,jsx,tsx}", |
||||
|
||||
// Or if using `src` directory:
|
||||
"./src/**/*.{js,ts,jsx,tsx}", |
||||
], |
||||
theme: { |
||||
extend: {}, |
||||
}, |
||||
plugins: [require("daisyui")], |
||||
} |
@ -0,0 +1,29 @@ |
||||
{ |
||||
"compilerOptions": { |
||||
"target": "es5", |
||||
"lib": ["dom", "dom.iterable", "esnext"], |
||||
"allowJs": true, |
||||
"skipLibCheck": true, |
||||
"strict": true, |
||||
"forceConsistentCasingInFileNames": true, |
||||
"noEmit": true, |
||||
"esModuleInterop": true, |
||||
"module": "esnext", |
||||
"moduleResolution": "node", |
||||
"resolveJsonModule": true, |
||||
"isolatedModules": true, |
||||
"jsx": "preserve", |
||||
"incremental": true, |
||||
"plugins": [ |
||||
{ |
||||
"name": "next" |
||||
} |
||||
], |
||||
"baseUrl": ".", |
||||
"paths": { |
||||
"@/*": ["./src/*"] |
||||
} |
||||
}, |
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], |
||||
"exclude": ["node_modules"] |
||||
} |
Loading…
Reference in new issue