🔥 Remove all things bootstrap

This commit is contained in:
nikolark committed 2022-03-05 20:00:03 +01:00
1 parent 06f43b06b8
commit 54bbd75730
17 files changed
+73 -202

No files matched your search

-98
View File
@@ -12,8 +12,6 @@
"@nivo/bar": "^0.79.1", "@nivo/bar": "^0.79.1",
"@nivo/line": "^0.79.1", "@nivo/line": "^0.79.1",
"@nivo/pie": "^0.79.1", "@nivo/pie": "^0.79.1",
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.8.1",
"clsx": "^1.1.1", "clsx": "^1.1.1",
"date-fns": "^2.28.0", "date-fns": "^2.28.0",
"graphql": "^16.3.0", "graphql": "^16.3.0",
@@ -28,7 +26,6 @@
"@graphql-codegen/typed-document-node": "^2.2.3", "@graphql-codegen/typed-document-node": "^2.2.3",
"@graphql-codegen/typescript-operations": "^2.3.0", "@graphql-codegen/typescript-operations": "^2.3.0",
"@graphql-typed-document-node/core": "^3.1.1", "@graphql-typed-document-node/core": "^3.1.1",
"@types/bootstrap": "^5.1.9",
"@types/react": "^17.0.39", "@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^17.0.11",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "^5.3.3",
@@ -2588,15 +2585,6 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/@popperjs/core": {
"version": "2.11.2",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz",
"integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@react-spring/animated": { "node_modules/@react-spring/animated": {
"version": "9.3.2", "version": "9.3.2",
"resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.3.2.tgz", "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.3.2.tgz",
@@ -2785,16 +2773,6 @@
"@babel/types": "^7.3.0" "@babel/types": "^7.3.0"
} }
}, },
"node_modules/@types/bootstrap": {
"version": "5.1.9",
"resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.1.9.tgz",
"integrity": "sha512-Tembe6lt7819EUzV5LSG9uuwULm4hdEGV9LZ8QBYpWc0J+a+9DdmJEwZ4FMaXGVJWwumTPSkJ8JQF0/KDAmXYg==",
"dev": true,
"dependencies": {
"@popperjs/core": "^2.9.2",
"@types/jquery": "*"
}
},
"node_modules/@types/graceful-fs": { "node_modules/@types/graceful-fs": {
"version": "4.1.5", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz",
@@ -2834,15 +2812,6 @@
"@types/istanbul-lib-report": "*" "@types/istanbul-lib-report": "*"
} }
}, },
"node_modules/@types/jquery": {
"version": "3.5.13",
"resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.13.tgz",
"integrity": "sha512-ZxJrup8nz/ZxcU0vantG+TPdboMhB24jad2uSap50zE7Q9rUeYlCF25kFMSmHR33qoeOgqcdHEp3roaookC0Sg==",
"dev": true,
"dependencies": {
"@types/sizzle": "*"
}
},
"node_modules/@types/js-yaml": { "node_modules/@types/js-yaml": {
"version": "4.0.5", "version": "4.0.5",
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
@@ -2959,12 +2928,6 @@
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==",
"dev": true "dev": true
}, },
"node_modules/@types/sizzle": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz",
"integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==",
"dev": true
},
"node_modules/@types/stack-utils": { "node_modules/@types/stack-utils": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz",
@@ -3737,26 +3700,6 @@
"readable-stream": "^3.4.0" "readable-stream": "^3.4.0"
} }
}, },
"node_modules/bootstrap": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz",
"integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/bootstrap"
},
"peerDependencies": {
"@popperjs/core": "^2.10.2"
}
},
"node_modules/bootstrap-icons": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.8.1.tgz",
"integrity": "sha512-IXUqislddPJfwq6H+2nTkHyr9epO9h6u1AG0OZCx616w+TgzeoCjfmI3qJMQqt1J586gN2IxzB4M99Ip4sTZ1w==",
"engines": {
"node": ">=10"
}
},
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -14527,11 +14470,6 @@
"fastq": "^1.6.0" "fastq": "^1.6.0"
} }
}, },
"@popperjs/core": {
"version": "2.11.2",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz",
"integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA=="
},
"@react-spring/animated": { "@react-spring/animated": {
"version": "9.3.2", "version": "9.3.2",
"resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.3.2.tgz", "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.3.2.tgz",
@@ -14680,16 +14618,6 @@
"@babel/types": "^7.3.0" "@babel/types": "^7.3.0"
} }
}, },
"@types/bootstrap": {
"version": "5.1.9",
"resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.1.9.tgz",
"integrity": "sha512-Tembe6lt7819EUzV5LSG9uuwULm4hdEGV9LZ8QBYpWc0J+a+9DdmJEwZ4FMaXGVJWwumTPSkJ8JQF0/KDAmXYg==",
"dev": true,
"requires": {
"@popperjs/core": "^2.9.2",
"@types/jquery": "*"
}
},
"@types/graceful-fs": { "@types/graceful-fs": {
"version": "4.1.5", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz",
@@ -14729,15 +14657,6 @@
"@types/istanbul-lib-report": "*" "@types/istanbul-lib-report": "*"
} }
}, },
"@types/jquery": {
"version": "3.5.13",
"resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.13.tgz",
"integrity": "sha512-ZxJrup8nz/ZxcU0vantG+TPdboMhB24jad2uSap50zE7Q9rUeYlCF25kFMSmHR33qoeOgqcdHEp3roaookC0Sg==",
"dev": true,
"requires": {
"@types/sizzle": "*"
}
},
"@types/js-yaml": { "@types/js-yaml": {
"version": "4.0.5", "version": "4.0.5",
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
@@ -14854,12 +14773,6 @@
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==",
"dev": true "dev": true
}, },
"@types/sizzle": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz",
"integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==",
"dev": true
},
"@types/stack-utils": { "@types/stack-utils": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz",
@@ -15407,17 +15320,6 @@
"readable-stream": "^3.4.0" "readable-stream": "^3.4.0"
} }
}, },
"bootstrap": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz",
"integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==",
"requires": {}
},
"bootstrap-icons": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.8.1.tgz",
"integrity": "sha512-IXUqislddPJfwq6H+2nTkHyr9epO9h6u1AG0OZCx616w+TgzeoCjfmI3qJMQqt1J586gN2IxzB4M99Ip4sTZ1w=="
},
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
-3
View File
@@ -20,8 +20,6 @@
"@nivo/bar": "^0.79.1", "@nivo/bar": "^0.79.1",
"@nivo/line": "^0.79.1", "@nivo/line": "^0.79.1",
"@nivo/pie": "^0.79.1", "@nivo/pie": "^0.79.1",
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.8.1",
"clsx": "^1.1.1", "clsx": "^1.1.1",
"date-fns": "^2.28.0", "date-fns": "^2.28.0",
"graphql": "^16.3.0", "graphql": "^16.3.0",
@@ -36,7 +34,6 @@
"@graphql-codegen/typed-document-node": "^2.2.3", "@graphql-codegen/typed-document-node": "^2.2.3",
"@graphql-codegen/typescript-operations": "^2.3.0", "@graphql-codegen/typescript-operations": "^2.3.0",
"@graphql-typed-document-node/core": "^3.1.1", "@graphql-typed-document-node/core": "^3.1.1",
"@types/bootstrap": "^5.1.9",
"@types/react": "^17.0.39", "@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^17.0.11",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "^5.3.3",
-1
View File
@@ -1,7 +1,6 @@
import { ApolloProvider } from "@apollo/client"; import { ApolloProvider } from "@apollo/client";
import React from "react"; import React from "react";
import { BrowserRouter as Router } from "react-router-dom"; import { BrowserRouter as Router } from "react-router-dom";
import "bootstrap/dist/css/bootstrap.min.css";
import styles from "./App.module.css"; import styles from "./App.module.css";
import { Routes } from "./Routes"; import { Routes } from "./Routes";
+13 -39
View File
@@ -1,7 +1,3 @@
import { ReactComponent as BarChart } from "bootstrap-icons/icons/bar-chart.svg";
import { ReactComponent as CardList } from "bootstrap-icons/icons/card-list.svg";
import { ReactComponent as House } from "bootstrap-icons/icons/house.svg";
import { ReactComponent as PeopleIcon } from "bootstrap-icons/icons/people.svg";
import React from "react"; import React from "react";
import { NavLink } from "react-router-dom"; import { NavLink } from "react-router-dom";
@@ -15,71 +11,49 @@ const navLinkStyles = ({ isActive }: { isActive: boolean }) => (isActive ? "nav-
export const Header: React.FC = () => { export const Header: React.FC = () => {
return ( return (
<header> <header>
<nav className="navbar navbar-dark bg-dark navbar-expand-md"> <nav>
<NavLink to="/" className="navbar-brand"> <NavLink to="/">
<span className={styles.logo}> <span className={styles.logo}>
<Logo /> <Logo />
</span> </span>
Biceps Bar System - BBS Biceps Bar System - BBS
</NavLink> </NavLink>
<button <button type="button" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
className="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span className="navbar-toggler-icon" /> <span className="navbar-toggler-icon" />
</button> </button>
<div className="collapse navbar-collapse" id="navbarNav"> <div id="navbarNav">
<ul className="navbar-nav"> <ul>
<li className="nav-item"> <li>
<NavLink to="/" className={navLinkStyles} end> <NavLink to="/" className={navLinkStyles} end>
<span className={styles.navIcon}>
<House />
</span>{" "}
Kjøp drikke Kjøp drikke
</NavLink> </NavLink>
</li> </li>
<li className="nav-item"> <li>
<NavLink to="/deposit" className={navLinkStyles}> <NavLink to="/deposit" className={navLinkStyles}>
Sett inn penger Sett inn penger
</NavLink> </NavLink>
</li> </li>
<li className="nav-item"> <li>
<NavLink to="/log" className={navLinkStyles}> <NavLink to="/log" className={navLinkStyles}>
<span className={styles.navIcon}>
<CardList />
</span>{" "}
Logg Logg
</NavLink> </NavLink>
</li> </li>
<li className="nav-item"> <li>
<NavLink to="/stats" className={navLinkStyles}> <NavLink to="/stats" className={navLinkStyles}>
<span className={styles.navIcon}>
<BarChart />
</span>{" "}
Statistikk Statistikk
</NavLink> </NavLink>
</li> </li>
<li className="nav-item"> <li>
<NavLink to="/users" className={navLinkStyles}> <NavLink to="/users" className={navLinkStyles}>
<span className={styles.navIcon}>
<PeopleIcon />
</span>{" "}
Folk Folk
</NavLink> </NavLink>
</li> </li>
</ul> </ul>
</div> </div>
<ul className="navbar-nav"> <ul>
<li className="nav-item"> <li>
<a href={ADMIN_URL} className="nav-link"> <a href={ADMIN_URL}>Admin</a>
Admin
</a>
</li> </li>
</ul> </ul>
</nav> </nav>
@@ -9,17 +9,21 @@
border-radius: 8px; border-radius: 8px;
transition: background-color 0.1s ease-out, border 0.1s ease-out; transition: background-color 0.1s ease-out, border 0.1s ease-out;
} }
.product:hover { .product:hover {
border-color: rgba(25, 135, 84, 0.6); border-color: rgba(25, 135, 84, 0.6);
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
} }
.active { .active {
border-color: rgba(25, 135, 84, 0.6); border-color: rgba(25, 135, 84, 0.6);
background: rgba(25, 135, 84, 0.2); background: rgba(25, 135, 84, 0.2);
} }
.active:hover { .active:hover {
background: rgba(25, 135, 84, 0.2); background: rgba(25, 135, 84, 0.2);
} }
.productText { .productText {
position: absolute; position: absolute;
right: 0; right: 0;
@@ -31,15 +35,18 @@
color: white; color: white;
font-weight: bold; font-weight: bold;
} }
.productImage { .productImage {
width: 140px; width: 140px;
height: 140px; height: 140px;
object-fit: contain; object-fit: contain;
} }
.noProductImage { .noProductImage {
width: 140px; width: 140px;
height: 140px; height: 140px;
} }
.amount { .amount {
position: absolute; position: absolute;
top: 0px; top: 0px;
@@ -52,6 +59,7 @@
font-weight: bold; font-weight: bold;
line-height: 1; line-height: 1;
} }
.wrap { .wrap {
position: relative; position: relative;
} }
+9 -17
View File
@@ -1,4 +1,3 @@
import { Toast as BSToast } from "bootstrap";
import clsx from "clsx"; import clsx from "clsx";
import React, { useEffect, useRef } from "react"; import React, { useEffect, useRef } from "react";
@@ -9,33 +8,26 @@ export const Toast: React.FC = () => {
const ref = useRef<HTMLInputElement>(null); const ref = useRef<HTMLInputElement>(null);
const { visible, showToast, message, background } = useToast(); const { visible, showToast, message, background } = useToast();
const backgroundColor = `bg-${background}`; const classes = clsx(`bg-${background}`, styles.toast);
const classes = clsx("toast align-items-center text-white bg-primary border-0", backgroundColor, styles.toast);
useEffect(() => { useEffect(() => {
if (!ref.current) return; if (!ref.current) return;
const bsToast = BSToast.getInstance(ref.current) || new BSToast(ref.current);
if (visible) { if (visible) {
bsToast?.show(); // TODO
console.log("TODO: show");
} else if (!visible) { } else if (!visible) {
bsToast?.hide(); // TODO
console.log("TODO: hide");
} }
return () => bsToast?.hide(); // TODO
return () => console.log("TODO: hide");
}, [visible]); }, [visible]);
return ( return (
<div ref={ref} className={classes} role="alert" aria-live="assertive" aria-atomic="true"> <div ref={ref} className={classes} role="alert" aria-live="assertive" aria-atomic="true">
<div className="d-flex"> <div>{message}</div>
<div className="toast-body">{message}</div> <button type="button" aria-label="Close" onClick={() => showToast(message)} />
<button
type="button"
className="btn-close btn-close-white me-2 m-auto"
data-bs-dismiss="toast"
aria-label="Close"
onClick={() => showToast(message)}
/>
</div>
</div> </div>
); );
}; };
@@ -8,27 +8,33 @@
border-radius: 8px; border-radius: 8px;
transition: background-color 0.1s ease-out, border 0.1s ease-out; transition: background-color 0.1s ease-out, border 0.1s ease-out;
} }
.user:hover { .user:hover {
border-color: rgba(25, 135, 84, 0.6); border-color: rgba(25, 135, 84, 0.6);
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
} }
.active { .active {
border-color: rgba(25, 135, 84, 0.6); border-color: rgba(25, 135, 84, 0.6);
background: rgba(25, 135, 84, 0.2); background: rgba(25, 135, 84, 0.2);
} }
.active:hover { .active:hover {
background: rgba(25, 135, 84, 0.2); background: rgba(25, 135, 84, 0.2);
} }
.avatar { .avatar {
width: 50px; width: 50px;
height: 50px; height: 50px;
border-radius: 50px; border-radius: 50px;
} }
.avatar svg { .avatar svg {
width: 50px; width: 50px;
height: 50px; height: 50px;
color: #ccc; color: #ccc;
} }
.name { .name {
font-weight: bold; font-weight: bold;
} }
+1 -6
View File
@@ -1,4 +1,3 @@
import { ReactComponent as PersonFill } from "bootstrap-icons/icons/person-fill.svg";
import clsx from "clsx"; import clsx from "clsx";
import React, { MouseEventHandler } from "react"; import React, { MouseEventHandler } from "react";
@@ -19,11 +18,7 @@ export const UserCard: React.FC<UserCardProps> = ({ user, onUser, active = false
{user?.profile?.image && ( {user?.profile?.image && (
<img src={user.profile?.image} alt={`Profile for ${user.firstName}`} className={styles.avatar} /> <img src={user.profile?.image} alt={`Profile for ${user.firstName}`} className={styles.avatar} />
)} )}
{!user?.profile?.image && ( {!user?.profile?.image && <span className={styles.avatar}>TODO: NO IMAGE</span>}
<span className={styles.avatar}>
<PersonFill />
</span>
)}
<span className={styles.name}>{user?.firstName || "Ekstern"}</span> <span className={styles.name}>{user?.firstName || "Ekstern"}</span>
<span className={styles.balance}>{user?.profile?.balance || ""}</span> <span className={styles.balance}>{user?.profile?.balance || ""}</span>
</button> </button>
@@ -5,9 +5,11 @@
overflow-y: auto; overflow-y: auto;
row-gap: 16px; row-gap: 16px;
} }
.amountSection { .amountSection {
margin-top: 32px; margin-top: 32px;
} }
.checkout { .checkout {
margin-top: 32px; margin-top: 32px;
} }
+3 -3
View File
@@ -33,7 +33,7 @@ export const Deposit: React.FC = () => {
placeholder="Filtrér på navn" placeholder="Filtrér på navn"
/> />
{userQuery !== "" && ( {userQuery !== "" && (
<button className="btn btn-link" type="button" onClick={() => setUserQuery("")}> <button type="button" onClick={() => setUserQuery("")}>
Vis alle Vis alle
</button> </button>
)} )}
@@ -55,10 +55,10 @@ export const Deposit: React.FC = () => {
<input name="amount" value={amount} onChange={(event) => setAmount(event.target.value)} placeholder="0" /> <input name="amount" value={amount} onChange={(event) => setAmount(event.target.value)} placeholder="0" />
</section> </section>
<section className={styles.checkout}> <section className={styles.checkout}>
<button type="button" className="btn btn-primary btn-lg" onClick={onSubmit}> <button type="button" onClick={onSubmit}>
Sett inn Sett inn
</button>{" "} </button>{" "}
<button type="button" className="btn btn-outline-secondary btn-lg" onClick={reset}> <button type="button" onClick={reset}>
Start på nytt Start på nytt
</button> </button>
</section> </section>
+8 -12
View File
@@ -34,7 +34,7 @@ export const Log = () => {
<div className={styles.log}> <div className={styles.log}>
<div> <div>
<h2>Ordre</h2> <h2>Ordre</h2>
<table className="table"> <table>
<thead> <thead>
<tr> <tr>
<th scope="col">Når</th> <th scope="col">Når</th>
@@ -61,11 +61,10 @@ export const Log = () => {
</tbody> </tbody>
</table> </table>
<nav aria-label="Order pagination"> <nav aria-label="Order pagination">
<ul className="pagination"> <ul>
<li className={clsx("page-item", { disabled: orderOffset <= 0 })}> <li className={clsx({ disabled: orderOffset <= 0 })}>
<a <a
href="#" href="#"
className="page-link"
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
setParams({ orderOffset: orderOffset - PAGE_SIZE }); setParams({ orderOffset: orderOffset - PAGE_SIZE });
@@ -74,10 +73,9 @@ export const Log = () => {
Previous Previous
</a> </a>
</li> </li>
<li className="page-item"> <li>
<a <a
href="#" href="#"
className="page-link"
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
setParams({ orderOffset: orderOffset + PAGE_SIZE }); setParams({ orderOffset: orderOffset + PAGE_SIZE });
@@ -91,7 +89,7 @@ export const Log = () => {
</div> </div>
<div> <div>
<h2>Transaksjoner</h2> <h2>Transaksjoner</h2>
<table className="table"> <table>
<thead> <thead>
<tr> <tr>
<th scope="col">Når</th> <th scope="col">Når</th>
@@ -112,11 +110,10 @@ export const Log = () => {
</tbody> </tbody>
</table> </table>
<nav aria-label="Transaction pagination"> <nav aria-label="Transaction pagination">
<ul className="pagination"> <ul>
<li className={clsx("page-item", { disabled: transactionOffset <= 0 })}> <li className={clsx({ disabled: transactionOffset <= 0 })}>
<a <a
href="#" href="#"
className="page-link"
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
setParams({ transactionOffset: transactionOffset - PAGE_SIZE }); setParams({ transactionOffset: transactionOffset - PAGE_SIZE });
@@ -125,10 +122,9 @@ export const Log = () => {
Previous Previous
</a> </a>
</li> </li>
<li className="page-item"> <li>
<a <a
href="#" href="#"
className="page-link"
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
setParams({ transactionOffset: transactionOffset + PAGE_SIZE }); setParams({ transactionOffset: transactionOffset + PAGE_SIZE });
@@ -9,6 +9,7 @@
grid-template-columns: repeat(8, 150px); grid-template-columns: repeat(8, 150px);
row-gap: 16px; row-gap: 16px;
} }
.productListSection { .productListSection {
margin-top: 2rem; margin-top: 2rem;
} }
+3 -3
View File
@@ -48,7 +48,7 @@ export const Register: React.FC = () => {
/> />
))} ))}
</div> </div>
<button type="button" className="btn btn-link" onClick={() => setShowAll(!showAll)}> <button type="button" onClick={() => setShowAll(!showAll)}>
{showAll ? "Skjul gamliser" : "Vis alle"} {showAll ? "Skjul gamliser" : "Vis alle"}
</button> </button>
</section> </section>
@@ -70,10 +70,10 @@ export const Register: React.FC = () => {
<span className={styles.total}> <span className={styles.total}>
Totalt: <span>{total}</span> Totalt: <span>{total}</span>
</span> </span>
<button type="button" className="btn btn-primary btn-lg" onClick={onSubmit}> <button type="button" onClick={onSubmit}>
Kjøp Kjøp
</button>{" "} </button>{" "}
<button type="button" className="btn btn-outline-secondary btn-lg" onClick={reset}> <button type="button" onClick={reset}>
Start på nytt Start på nytt
</button> </button>
</section> </section>
@@ -4,6 +4,7 @@
gap: 1rem; gap: 1rem;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
} }
.statsNav { .statsNav {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
+6 -6
View File
@@ -6,24 +6,24 @@ const navLinkStyles = ({ isActive }: { isActive: boolean }) => (isActive ? "nav-
export const StatsNav = () => ( export const StatsNav = () => (
<div className={styles.statsNav}> <div className={styles.statsNav}>
<ul className="nav nav-tabs"> <ul>
<li className="nav-item"> <li>
<NavLink className={navLinkStyles} to="/stats" end> <NavLink className={navLinkStyles} to="/stats" end>
Oversikt Oversikt
</NavLink> </NavLink>
</li> </li>
<li className="nav-item"> <li>
<NavLink className={navLinkStyles} to="/stats/products"> <NavLink className={navLinkStyles} to="/stats/products">
Produkter Produkter
</NavLink> </NavLink>
</li> </li>
<li className="nav-item"> <li>
<NavLink className={navLinkStyles} to="/stats/orders"> <NavLink className={navLinkStyles} to="/stats/orders">
Ordre Ordre
</NavLink> </NavLink>
</li> </li>
<li className="nav-item"> <li>
<NavLink className="nav-link disabled" to="/stats/users" title="TODO"> <NavLink className="disabled" to="/stats/users" title="TODO">
Folk Folk
</NavLink> </NavLink>
</li> </li>
+10 -10
View File
@@ -30,26 +30,26 @@ export const UserDetail = () => {
<h1> <h1>
{profile.image && <img src={profile.image} alt={`${user.firstName}s profile picture`} />} {user.firstName} {profile.image && <img src={profile.image} alt={`${user.firstName}s profile picture`} />} {user.firstName}
</h1> </h1>
<div className="card"> <div>
<div className="card-header">Stats</div> <div>Stats</div>
<ul className="list-group list-group-flush"> <ul>
<li className="list-group-item"> <li>
Saldo: <strong>{profile.balance.toLocaleString("no")} kr</strong> Saldo: <strong>{profile.balance.toLocaleString("no")} kr</strong>
</li> </li>
<li className="list-group-item"> <li>
Siste kjøp: <strong>{formatTime(profile.lastPurchaseDate)}</strong> Siste kjøp: <strong>{formatTime(profile.lastPurchaseDate)}</strong>
</li> </li>
<li className="list-group-item"> <li>
Kjøp totalt: <strong>{profile.orderSumTotal.toLocaleString("no")} kr</strong> Kjøp totalt: <strong>{profile.orderSumTotal.toLocaleString("no")} kr</strong>
</li> </li>
</ul> </ul>
</div> </div>
<br /> <br />
<div className="card"> <div>
<div className="card-header">Top 5 måneder</div> <div>Top 5 måneder</div>
<ul className="list-group list-group-flush"> <ul>
{profile.topMonths.map((topMonth) => ( {profile.topMonths.map((topMonth) => (
<li key={topMonth.period} className="list-group-item"> <li key={topMonth.period}>
{formatMonth(topMonth.period)}: <strong>{topMonth.count}</strong> kjøp på totalt{" "} {formatMonth(topMonth.period)}: <strong>{topMonth.count}</strong> kjøp på totalt{" "}
<strong>{topMonth.sum} kr</strong> <strong>{topMonth.sum} kr</strong>
</li> </li>
+2 -4
View File
@@ -15,7 +15,7 @@ export const UserList = () => {
const users = showAll ? allUsers : allUsers.filter((u) => activeUserFilter(u)); const users = showAll ? allUsers : allUsers.filter((u) => activeUserFilter(u));
return ( return (
<div> <div>
<button type="button" className="btn btn-link" onClick={() => setShowAll(!showAll)}> <button type="button" onClick={() => setShowAll(!showAll)}>
{showAll ? "Skjul gamliser" : "Vis alle"} {showAll ? "Skjul gamliser" : "Vis alle"}
</button> </button>
<ul> <ul>
@@ -28,9 +28,7 @@ export const UserList = () => {
))} ))}
</ul> </ul>
<br /> <br />
<Link to="/users/create" className="btn btn-primary"> <Link to="/users/create">Opprett ny</Link>
Opprett ny
</Link>
</div> </div>
); );
}; };