debut projet

This commit is contained in:
2026-03-16 16:43:17 +01:00
parent 5564a5b807
commit 038c52efc0
26 changed files with 18668 additions and 0 deletions

BIN
04-introduction-react.pdf Normal file

Binary file not shown.

23
my-library/.gitignore vendored Normal file
View File

@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

70
my-library/README.md Normal file
View File

@@ -0,0 +1,70 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

17303
my-library/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

40
my-library/package.json Normal file
View File

@@ -0,0 +1,40 @@
{
"name": "my-library",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^13.5.0",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"react-router-dom": "^7.13.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Biblio</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400;1,600&display=swap" rel="stylesheet" />
</head>
<body>
<div id="root"></div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

38
my-library/src/App.css Normal file
View File

@@ -0,0 +1,38 @@
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

14
my-library/src/App.jsx Normal file
View File

@@ -0,0 +1,14 @@
import { Routes, Route } from 'react-router-dom';
import Navbar from './components/Navbar';
import Home from './pages/Home';
export default function App() {
return (
<>
<Navbar />
<Routes>
<Route path="/" element={<Home />} />
</Routes>
</>
);
}

View File

@@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@@ -0,0 +1,22 @@
import { Link } from 'react-router-dom';
import '../styles/navbar.css';
export default function Navbar() {
return (
<nav className="navbar">
<Link to="/" className="navbar__logo">Biblio</Link>
<ul className="navbar__links">
<li><Link to="/">Accueil</Link></li>
<li><Link to="/books">Catalogue</Link></li>
<li><Link to="/orders">Commandes</Link></li>
<li><Link to="/profile">Mon compte</Link></li>
</ul>
<div className="navbar__actions">
<button className="btn-ghost">Connexion</button>
<button className="btn-cta">S'inscrire</button>
</div>
</nav>
);
}

13
my-library/src/index.css Normal file
View File

@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

14
my-library/src/index.js Normal file
View File

@@ -0,0 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import App from './App';
import './styles/global.css';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>
);

1
my-library/src/logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,91 @@
import { Link } from 'react-router-dom';
import '../styles/home.css';
const features = [
{ icon: '📚', title: 'Enregistrer un livre', desc: 'Ajoutez un nouveau titre au catalogue de la bibliothèque.', role: 'admin', path: '/books/new' },
{ icon: '🛒', title: 'Passer une commande', desc: 'Commandez vos livres préférés en quelques secondes.', role: 'user', path: '/orders/new' },
{ icon: '🏷️', title: 'Appliquer une promotion', desc: 'Créez et gérez vos codes promotionnels.', role: 'admin', path: '/promotions/new' },
{ icon: '📌', title: 'Réserver un livre', desc: 'Réservez un exemplaire avant sa disponibilité.', role: 'user', path: '/reservations/new' },
{ icon: '↩️', title: 'Retour de livre', desc: 'Gérez les retours et remises en stock.', role: 'admin', path: '/returns/new' },
{ icon: '⭐', title: 'Points de fidélité', desc: 'Consultez et utilisez vos points cumulés.', role: 'user', path: '/loyalty' },
{ icon: '💬', title: 'Laisser un avis', desc: 'Partagez votre opinion sur vos dernières lectures.', role: 'user', path: '/reviews/new' },
{ icon: '🎫', title: 'Créer un abonnement', desc: 'Souscrivez à un abonnement mensuel ou annuel.', role: 'user', path: '/subscriptions/new' },
{ icon: '🤝', title: 'Prêt entre lecteurs', desc: "Prêtez vos livres à d'autres membres de la communauté.", role: 'user', path: '/loans/new' },
{ icon: '👥', title: 'Commande groupée', desc: 'Participez à des achats groupés avantageux.', role: 'user', path: '/group-orders' },
];
const stats = [
{ value: '10 000+', label: 'Livres disponibles' },
{ value: '5 000+', label: 'Lecteurs actifs' },
{ value: '50+', label: 'Catégories' },
];
export default function Home() {
return (
<main>
{/* Hero */}
<section className="hero">
<p className="hero__eyebrow">Votre bibliothèque en ligne</p>
<h1 className="hero__title">
Des livres pour tous,
<span className="hero__title-italic">partout, toujours.</span>
</h1>
<div className="hero__rule" />
<p className="hero__subtitle">
Commandez, réservez, prêtez et partagez vos lectures.
Une plateforme pensée pour les vrais amoureux des livres.
</p>
<div className="hero__actions">
<Link to="/books">
<button className="hero__btn-primary">Explorer le catalogue</button>
</Link>
<button className="hero__btn-secondary">En savoir plus</button>
</div>
</section>
{/* Stats */}
<section className="stats">
{stats.map(({ value, label }) => (
<div key={label} className="stats__item">
<div className="stats__value">{value}</div>
<div className="stats__label">{label}</div>
</div>
))}
</section>
{/* Features */}
<div className="section-header">
<p className="section-header__eyebrow">Fonctionnalités</p>
<h2 className="section-header__title">Tout ce dont vous avez besoin</h2>
</div>
<section className="features">
<div className="features__grid">
{features.map((f) => (
<Link to={f.path} key={f.title} className="feature-card">
<div className="feature-card__glyph">{f.icon}</div>
<span className={`badge badge--${f.role}`}>
{f.role === 'admin' ? 'Administrateur' : 'Utilisateur'}
</span>
<h3 className="feature-card__title">{f.title}</h3>
<p className="feature-card__desc">{f.desc}</p>
<span className="feature-card__arrow"> Accéder</span>
</Link>
))}
</div>
</section>
{/* Footer CTA */}
<section className="home-cta">
<div className="home-cta__rule" />
<h2 className="home-cta__title">
Prêt à commencer<br />votre aventure ?
</h2>
<p className="home-cta__sub">Rejoignez des milliers de lecteurs dès aujourd'hui.</p>
<Link to="/register">
<span className="home-cta__btn">Créer un compte gratuit</span>
</Link>
</section>
</main>
);
}

View File

@@ -0,0 +1,13 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View File

@@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

View File

@@ -0,0 +1,52 @@
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
:root {
--bg: #0d0b08;
--bg-raised: #111009;
--bg-card: #0f0d0a;
--gold: #c9a84c;
--gold-dim: rgba(201, 168, 76, 0.45);
--gold-faint:rgba(201, 168, 76, 0.1);
--parchment: #f0e6d0;
--text: #e8dcc8;
--text-muted:rgba(232, 220, 200, 0.45);
--text-dim: rgba(232, 220, 200, 0.25);
--rust: #c05a2a;
--rust-dim: rgba(192, 90, 42, 0.4);
--border: rgba(180, 150, 80, 0.15);
--border-hi: rgba(180, 150, 80, 0.3);
--font-title:'Cinzel', 'Palatino Linotype', Georgia, serif;
--font-body: 'Cormorant Garamond', 'Palatino Linotype', Georgia, serif;
}
html { scroll-behavior: smooth; }
body {
background-color: var(--bg);
color: var(--text);
font-family: var(--font-body);
font-size: 18px;
line-height: 1.7;
-webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
font-family: var(--font-title);
}
a {
color: inherit;
text-decoration: none;
}
button {
cursor: pointer;
font-family: var(--font-title);
border: none;
outline: none;
background: none;
}

View File

@@ -0,0 +1,372 @@
/* ── Hero ───────────────────────────── */
.hero {
padding: 110px 48px 90px;
text-align: center;
border-bottom: 1px solid var(--border);
position: relative;
overflow: hidden;
}
.hero::before {
content: '';
position: absolute;
top: -80px;
left: 50%;
transform: translateX(-50%);
width: 600px;
height: 400px;
background: radial-gradient(ellipse, rgba(180, 140, 50, 0.06) 0%, transparent 70%);
pointer-events: none;
}
.hero__eyebrow {
font-family: var(--font-title);
font-size: 0.65rem;
letter-spacing: 0.28em;
text-transform: uppercase;
color: var(--gold);
opacity: 0.75;
margin-bottom: 22px;
opacity: 0;
animation: fadeUp 0.7s 0.1s ease forwards;
}
.hero__title {
font-family: var(--font-title);
font-size: clamp(2.4rem, 5.5vw, 4.5rem);
font-weight: 600;
letter-spacing: 0.02em;
line-height: 1.1;
color: var(--parchment);
max-width: 820px;
margin: 0 auto 0;
opacity: 0;
animation: fadeUp 0.7s 0.2s ease forwards;
}
.hero__title-italic {
display: block;
font-family: var(--font-body);
font-style: italic;
font-weight: 400;
font-size: clamp(2.8rem, 6vw, 5rem);
color: var(--gold);
margin-top: 4px;
letter-spacing: 0;
}
.hero__rule {
width: 80px;
height: 1px;
background: linear-gradient(90deg, transparent, var(--gold), transparent);
margin: 28px auto;
opacity: 0;
animation: fadeUp 0.7s 0.3s ease forwards;
}
.hero__subtitle {
font-family: var(--font-body);
font-style: italic;
font-size: 1.1rem;
color: var(--text-muted);
max-width: 500px;
margin: 0 auto 40px;
line-height: 1.85;
opacity: 0;
animation: fadeUp 0.7s 0.35s ease forwards;
}
.hero__actions {
display: flex;
gap: 16px;
justify-content: center;
flex-wrap: wrap;
opacity: 0;
animation: fadeUp 0.7s 0.45s ease forwards;
}
.hero__btn-primary {
font-family: var(--font-title);
font-size: 0.68rem;
letter-spacing: 0.16em;
text-transform: uppercase;
color: var(--gold);
padding: 13px 30px;
border: 1px solid var(--gold-dim);
background: var(--gold-faint);
transition: background 0.2s, border-color 0.2s;
}
.hero__btn-primary:hover {
background: rgba(201, 168, 76, 0.2);
border-color: var(--gold);
}
.hero__btn-secondary {
font-family: var(--font-title);
font-size: 0.68rem;
letter-spacing: 0.16em;
text-transform: uppercase;
color: var(--text-muted);
padding: 13px 30px;
border: 1px solid rgba(232, 220, 200, 0.15);
transition: color 0.2s, border-color 0.2s;
}
.hero__btn-secondary:hover {
color: var(--text);
border-color: rgba(232, 220, 200, 0.35);
}
@keyframes fadeUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
/* ── Stats ───────────────────────────── */
.stats {
display: flex;
justify-content: center;
border-bottom: 1px solid var(--border);
}
.stats__item {
flex: 1;
max-width: 240px;
text-align: center;
padding: 36px 16px;
border-right: 1px solid var(--border);
}
.stats__item:last-child {
border-right: none;
}
.stats__value {
font-family: var(--font-title);
font-size: 2rem;
font-weight: 600;
color: var(--gold);
letter-spacing: 0.04em;
}
.stats__label {
font-family: var(--font-title);
font-size: 0.6rem;
letter-spacing: 0.18em;
text-transform: uppercase;
color: var(--text-dim);
margin-top: 6px;
}
/* ── Section header ──────────────────── */
.section-header {
text-align: center;
padding: 80px 24px 0;
}
.section-header__eyebrow {
font-family: var(--font-title);
font-size: 0.6rem;
letter-spacing: 0.28em;
text-transform: uppercase;
color: rgba(201, 168, 76, 0.55);
margin-bottom: 14px;
}
.section-header__title {
font-family: var(--font-title);
font-size: clamp(1.4rem, 3vw, 2.2rem);
font-weight: 600;
color: var(--parchment);
letter-spacing: 0.04em;
}
/* ── Features ────────────────────────── */
.features {
padding: 40px 0 80px;
}
.features__grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1px;
background: var(--border);
border-top: 1px solid var(--border);
border-bottom: 1px solid var(--border);
}
@media (max-width: 1000px) {
.features__grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
.features__grid { grid-template-columns: repeat(2, 1fr); }
.hero { padding: 80px 24px 60px; }
.navbar { padding: 0 20px; }
.stats { flex-direction: column; align-items: center; }
.stats__item { border-right: none; border-bottom: 1px solid var(--border); max-width: 100%; width: 100%; }
}
@media (max-width: 420px) {
.features__grid { grid-template-columns: 1fr; }
}
/* ── Feature card ────────────────────── */
.feature-card {
background: var(--bg);
padding: 30px 24px 26px;
display: flex;
flex-direction: column;
gap: 9px;
text-decoration: none;
color: var(--text);
transition: background 0.25s;
position: relative;
overflow: hidden;
}
.feature-card::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 1px;
background: linear-gradient(90deg, transparent, var(--gold), transparent);
opacity: 0;
transition: opacity 0.3s;
}
.feature-card:hover {
background: #131007;
}
.feature-card:hover::after {
opacity: 1;
}
.feature-card__glyph {
font-size: 1.4rem;
margin-bottom: 4px;
opacity: 0.8;
line-height: 1;
}
.feature-card__title {
font-family: var(--font-title);
font-size: 0.8rem;
font-weight: 600;
letter-spacing: 0.05em;
color: var(--parchment);
line-height: 1.4;
}
.feature-card__desc {
font-family: var(--font-body);
font-style: italic;
font-size: 0.9rem;
color: var(--text-muted);
line-height: 1.65;
flex: 1;
}
.feature-card__arrow {
font-family: var(--font-title);
font-size: 0.65rem;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--text-dim);
transition: color 0.2s;
margin-top: 6px;
}
.feature-card:hover .feature-card__arrow {
color: var(--gold);
}
.badge {
display: inline-block;
font-family: var(--font-title);
font-size: 0.55rem;
letter-spacing: 0.12em;
text-transform: uppercase;
padding: 3px 9px;
align-self: flex-start;
margin-bottom: 2px;
}
.badge--admin {
border: 1px solid var(--rust-dim);
color: var(--rust);
}
.badge--user {
border: 1px solid var(--gold-dim);
color: rgba(201, 168, 76, 0.65);
}
/* ── Footer CTA ──────────────────────── */
.home-cta {
padding: 100px 24px;
text-align: center;
border-top: 1px solid var(--border);
position: relative;
overflow: hidden;
}
.home-cta::before {
content: '';
position: absolute;
bottom: -60px;
left: 50%;
transform: translateX(-50%);
width: 500px;
height: 300px;
background: radial-gradient(ellipse, rgba(180, 140, 50, 0.05) 0%, transparent 70%);
pointer-events: none;
}
.home-cta__rule {
width: 60px;
height: 1px;
background: linear-gradient(90deg, transparent, var(--gold), transparent);
margin: 0 auto 32px;
}
.home-cta__title {
font-family: var(--font-title);
font-size: clamp(1.8rem, 4vw, 3rem);
font-weight: 600;
letter-spacing: 0.04em;
color: var(--parchment);
margin-bottom: 16px;
line-height: 1.15;
}
.home-cta__sub {
font-family: var(--font-body);
font-style: italic;
font-size: 1rem;
color: var(--text-muted);
margin-bottom: 40px;
}
.home-cta__btn {
display: inline-block;
font-family: var(--font-title);
font-size: 0.68rem;
letter-spacing: 0.18em;
text-transform: uppercase;
color: var(--gold);
padding: 13px 36px;
border: 1px solid var(--gold-dim);
background: var(--gold-faint);
transition: background 0.2s, border-color 0.2s;
cursor: pointer;
}
.home-cta__btn:hover {
background: rgba(201, 168, 76, 0.2);
border-color: var(--gold);
}

View File

@@ -0,0 +1,98 @@
.navbar {
position: sticky;
top: 0;
z-index: 200;
height: 56px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 48px;
background: rgba(13, 11, 8, 0.94);
border-bottom: 1px solid var(--border);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
.navbar__logo {
font-family: var(--font-title);
font-size: 1.05rem;
font-weight: 600;
letter-spacing: 0.22em;
color: var(--gold);
text-transform: uppercase;
}
.navbar__links {
display: flex;
gap: 8px;
list-style: none;
}
.navbar__links a {
font-family: var(--font-title);
font-size: 0.7rem;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--text-muted);
padding: 6px 14px;
transition: color 0.2s;
position: relative;
}
.navbar__links a::after {
content: '';
position: absolute;
bottom: 0;
left: 14px;
right: 14px;
height: 1px;
background: var(--gold);
transform: scaleX(0);
transition: transform 0.25s ease;
}
.navbar__links a:hover {
color: var(--gold);
}
.navbar__links a:hover::after {
transform: scaleX(1);
}
.navbar__actions {
display: flex;
gap: 10px;
}
.btn-ghost {
font-family: var(--font-title);
font-size: 0.65rem;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--text-muted);
padding: 7px 16px;
border: 1px solid rgba(232, 220, 200, 0.15);
transition: color 0.2s, border-color 0.2s;
}
.btn-ghost:hover {
color: var(--text);
border-color: rgba(232, 220, 200, 0.35);
}
.btn-cta {
font-family: var(--font-title);
font-size: 0.65rem;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--gold);
padding: 7px 16px;
border: 1px solid var(--gold-dim);
background: var(--gold-faint);
transition: background 0.2s, border-color 0.2s;
}
.btn-cta:hover {
background: rgba(201, 168, 76, 0.18);
border-color: var(--gold);
}

Binary file not shown.

449
swagger.txt Normal file
View File

@@ -0,0 +1,449 @@
openapi: 3.1.0
info:
title: My Library API
description: Documentation for My Library API
version: '1.0'
servers:
- url: http://localhost:8080
description: Generated server url
tags:
- name: Book Management
description: APIs for book operations
- name: Customer Management
description: APIs for managing customer information and loyalty points
paths:
/api/customers/{customerId}:
put:
tags:
- Customer Management
summary: Update customer information
description: Updates an existing customer's information
operationId: updateCustomer
parameters:
- name: customerId
in: path
description: Customer's UUID
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CustomerInfo'
required: true
responses:
'200':
description: Customer successfully updated
content:
'*/*':
schema:
$ref: '#/components/schemas/CustomerDTO'
'404':
description: Customer not found
content:
'*/*':
schema:
$ref: '#/components/schemas/CustomerDTO'
delete:
tags:
- Customer Management
summary: Delete a customer
description: Deletes a customer by their ID
operationId: deleteCustomer
parameters:
- name: customerId
in: path
description: Customer's UUID
required: true
schema:
type: string
format: uuid
responses:
'204':
description: Customer successfully deleted
'404':
description: Customer not found
/api/customers:
post:
tags:
- Customer Management
summary: Register a new customer
description: Creates a new customer with the provided information
operationId: registerCustomer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CustomerInfo'
required: true
responses:
'201':
description: Customer successfully registered
content:
'*/*':
schema:
type: string
format: uuid
'400':
description: Invalid customer information provided
content:
'*/*':
schema:
type: string
format: uuid
/api/customers/{customerId}/loyalty/subtract:
post:
tags:
- Customer Management
summary: Subtract loyalty points
description: Subtracts loyalty points from a customer's account
operationId: subtractLoyaltyPoints
parameters:
- name: customerId
in: path
description: Customer's UUID
required: true
schema:
type: string
format: uuid
- name: points
in: query
description: Number of points to subtract
required: true
schema:
type: integer
format: int32
responses:
'200':
description: Loyalty points successfully subtracted
content:
'*/*':
schema:
type: integer
format: int32
'400':
description: Not enough loyalty points
content:
'*/*':
schema:
type: integer
format: int32
'404':
description: Customer not found
content:
'*/*':
schema:
type: integer
format: int32
/api/customers/{customerId}/loyalty/add:
post:
tags:
- Customer Management
summary: Add loyalty points
description: Adds loyalty points to a customer's account
operationId: addLoyaltyPoints
parameters:
- name: customerId
in: path
description: Customer's UUID
required: true
schema:
type: string
format: uuid
- name: points
in: query
description: Number of points to add
required: true
schema:
type: integer
format: int32
responses:
'200':
description: Loyalty points successfully added
content:
'*/*':
schema:
type: integer
format: int32
'404':
description: Customer not found
content:
'*/*':
schema:
type: integer
format: int32
/api/books:
get:
tags:
- Book Management
summary: Get all books
description: Returns a paginated list of books
operationId: getBooks
parameters:
- name: pageable
in: query
required: true
schema:
$ref: '#/components/schemas/Pageable'
responses:
'200':
description: Successfully retrieved books
content:
'*/*':
schema:
$ref: '#/components/schemas/Page'
post:
tags:
- Book Management
summary: Register a new book
description: Adds a new book to the system
operationId: registerBook
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BookDTO'
required: true
responses:
'201':
description: Book successfully registered
content:
'*/*':
schema:
type: integer
format: int64
'400':
description: Invalid book data provided
content:
'*/*':
schema:
type: string
'406':
description: Conflict with existing book in database
content:
'*/*':
schema:
type: string
/api/customers/phone/{phoneNumber}:
get:
tags:
- Customer Management
summary: Find customer by phone number
description: Returns customer information based on phone number
operationId: findCustomerByPhoneNumber
parameters:
- name: phoneNumber
in: path
description: Customer's phone number
required: true
schema:
type: string
responses:
'200':
description: Customer found
content:
'*/*':
schema:
$ref: '#/components/schemas/CustomerDTO'
'404':
description: Customer not found
content:
'*/*':
schema:
$ref: '#/components/schemas/CustomerDTO'
/api/books/{bookId}:
get:
tags:
- Book Management
summary: Get book by ID
description: Retrieves a book by its ID
operationId: getBookById
parameters:
- name: bookId
in: path
description: ID of the book to retrieve
required: true
schema:
type: integer
format: int64
responses:
'200':
description: Book found
content:
'*/*':
schema:
$ref: '#/components/schemas/BookDTO'
'404':
description: Book not found
components:
schemas:
CustomerInfo:
type: object
properties:
firstName:
type: string
lastName:
type: string
phoneNumber:
type: string
required:
- firstName
- lastName
- phoneNumber
CustomerDTO:
type: object
properties:
id:
type: string
format: uuid
firstName:
type: string
lastName:
type: string
phoneNumber:
type: string
loyaltyPoints:
type: integer
format: int32
BookDTO:
type: object
properties:
isbn:
type: integer
format: int64
title:
type: string
maxLength: 255
minLength: 0
author:
type: string
publisher:
type: string
publicationDate:
type: string
format: date
price:
type: number
format: double
quantity:
type: integer
format: int32
categories:
type: array
description: Book categories
enum:
- FICTION
- NON_FICTION
- SCIENCE_FICTION
- FANTASY
- MYSTERY
- THRILLER
- ROMANCE
- BIOGRAPHY
- HISTORY
- POETRY
- CHILDRENS
- YOUNG_ADULT
- SCIENCE
- PHILOSOPHY
- SELF_HELP
- TRAVEL
- COOKING
- ART
- RELIGION
- REFERENCE
example:
- FICTION
- THRILLER
items:
type: string
description:
type: string
language:
type: string
required:
- author
- categories
- isbn
- language
- price
- publicationDate
- publisher
- quantity
- title
Pageable:
type: object
properties:
page:
type: integer
format: int32
minimum: 0
size:
type: integer
format: int32
minimum: 1
sort:
type: array
items:
type: string
Page:
type: object
properties:
totalElements:
type: integer
format: int64
totalPages:
type: integer
format: int32
size:
type: integer
format: int32
content:
type: array
items:
type: object
number:
type: integer
format: int32
sort:
$ref: '#/components/schemas/SortObject'
first:
type: boolean
last:
type: boolean
pageable:
$ref: '#/components/schemas/PageableObject'
numberOfElements:
type: integer
format: int32
empty:
type: boolean
PageableObject:
type: object
properties:
offset:
type: integer
format: int64
sort:
$ref: '#/components/schemas/SortObject'
pageSize:
type: integer
format: int32
pageNumber:
type: integer
format: int32
unpaged:
type: boolean
paged:
type: boolean
SortObject:
type: object
properties:
empty:
type: boolean
unsorted:
type: boolean
sorted:
type: boolean