Improve mobile responsiveness across pages

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
leanderandCopilot committed 2026-10-22 05:05:44 +02:00
1 parent c05820f61b
commit ac2ceddf78
13 files changed
+290 -166

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
.app { .app {
flex: 1 0 auto; flex: 1 0 auto;
max-width: 1220px; width: min(100% - 2rem, 1220px);
margin: 1rem auto; margin: 1rem auto;
} }
+32 -1
View File
@@ -1,12 +1,15 @@
.header { .header {
width: min(100% - 2rem, 1220px);
max-width: 1220px; max-width: 1220px;
margin: 1rem auto; margin: 1rem auto;
} }
.nav { .nav {
display: flex; display: flex;
height: 5rem; min-height: 5rem;
align-items: center; align-items: center;
flex-wrap: wrap;
gap: 0.5rem 1rem;
text-transform: uppercase; text-transform: uppercase;
} }
@@ -41,6 +44,8 @@
.navItems { .navItems {
display: flex; display: flex;
align-items: center; align-items: center;
flex: 1;
flex-wrap: wrap;
padding: 0; padding: 0;
margin: 0; margin: 0;
list-style: none; list-style: none;
@@ -58,6 +63,32 @@
color: white; color: white;
} }
@media (max-width: 640px) {
.nav {
align-items: flex-start;
}
.logoNav {
margin: 0 auto;
}
.navItems {
justify-content: center;
gap: 0.25rem;
}
.navLink {
display: inline-block;
padding: 0.5rem;
font-size: 0.8rem;
}
.brand {
padding-left: 0;
font-size: 2.5rem;
}
}
/* FIXME: Duplicates Splash styles */ /* FIXME: Duplicates Splash styles */
.brand { .brand {
padding-left: 1rem; padding-left: 1rem;
@@ -27,6 +27,12 @@
border-bottom: none; border-bottom: none;
} }
@media (max-width: 640px) {
.wireframe {
display: none;
}
}
@keyframes isometric-rotate { @keyframes isometric-rotate {
0% { 0% {
transform: rotateX(70deg) rotateY(0deg) rotateZ(-45deg); transform: rotateX(70deg) rotateY(0deg) rotateZ(-45deg);
@@ -3,3 +3,8 @@
max-width: 500px; max-width: 500px;
gap: 1rem; gap: 1rem;
} }
.form input {
width: 100%;
min-width: 0;
}
+28 -1
View File
@@ -1,7 +1,17 @@
.log { .log {
display: grid; display: grid;
min-width: 0;
gap: 1rem; gap: 1rem;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tableWrap {
max-width: 100%;
overflow-x: auto;
}
.tableWrap table {
width: 100%;
} }
.disabled, .disabled,
.disabled a:link { .disabled a:link {
@@ -30,3 +40,20 @@
.disabled a:hover { .disabled a:hover {
color: rgba(121, 152, 238, 0.5); color: rgba(121, 152, 238, 0.5);
} }
@media (max-width: 760px) {
.log {
grid-template-columns: minmax(0, 1fr);
}
}
@media (max-width: 480px) {
.pagination {
gap: 0 0.5rem;
}
.pagination a {
display: inline-block;
padding: 0.6rem 0.8rem;
}
}
+48 -44
View File
@@ -34,32 +34,34 @@ const Log = () => {
<div className={styles.log}> <div className={styles.log}>
<div> <div>
<h2>Ordre</h2> <h2>Ordre</h2>
<table> <div className={styles.tableWrap}>
<thead> <table>
<tr> <thead>
<th scope="col">Når</th> <tr>
<th scope="col">Hvem</th> <th scope="col">Når</th>
<th scope="col">Hva</th> <th scope="col">Hvem</th>
<th scope="col">Sum</th> <th scope="col">Hva</th>
</tr> <th scope="col">Sum</th>
</thead>
<tbody>
{orders.map((order) => (
<tr key={order.id}>
<td>{formatTime(order.created)}</td>
<td>{order.isExternal ? "Ekstern" : `${order.customer?.firstName} ${order.customer?.lastName}`}</td>
<td>
{(order.orderlines ?? []).map((line) => (
<div key={line.id}>
{Number(line.amount)}x {line.product.name}
</div>
))}
</td>
<td>{Number(order.orderSum)}</td>
</tr> </tr>
))} </thead>
</tbody> <tbody>
</table> {orders.map((order) => (
<tr key={order.id}>
<td>{formatTime(order.created)}</td>
<td>{order.isExternal ? "Ekstern" : `${order.customer?.firstName} ${order.customer?.lastName}`}</td>
<td>
{(order.orderlines ?? []).map((line) => (
<div key={line.id}>
{Number(line.amount)}x {line.product.name}
</div>
))}
</td>
<td>{Number(order.orderSum)}</td>
</tr>
))}
</tbody>
</table>
</div>
<nav aria-label="Order pagination"> <nav aria-label="Order pagination">
<ul className={styles.pagination}> <ul className={styles.pagination}>
<li className={clsx({ [styles.disabled]: orderOffset <= 0 })}> <li className={clsx({ [styles.disabled]: orderOffset <= 0 })}>
@@ -89,26 +91,28 @@ const Log = () => {
</div> </div>
<div> <div>
<h2>Transaksjoner</h2> <h2>Transaksjoner</h2>
<table> <div className={styles.tableWrap}>
<thead> <table>
<tr> <thead>
<th scope="col">Når</th> <tr>
<th scope="col">Hvem</th> <th scope="col">Når</th>
<th scope="col">Innskudd</th> <th scope="col">Hvem</th>
</tr> <th scope="col">Innskudd</th>
</thead>
<tbody>
{transactions.map((trans) => (
<tr key={trans.id}>
<td>{formatTime(trans.created)}</td>
<td>
{trans.user.firstName} {trans.user.lastName}
</td>
<td>{Number(trans.amount)}</td>
</tr> </tr>
))} </thead>
</tbody> <tbody>
</table> {transactions.map((trans) => (
<tr key={trans.id}>
<td>{formatTime(trans.created)}</td>
<td>
{trans.user.firstName} {trans.user.lastName}
</td>
<td>{Number(trans.amount)}</td>
</tr>
))}
</tbody>
</table>
</div>
<nav aria-label="Transaction pagination"> <nav aria-label="Transaction pagination">
<ul className={styles.pagination}> <ul className={styles.pagination}>
<li className={clsx({ [styles.disabled]: transactionOffset <= 0 })}> <li className={clsx({ [styles.disabled]: transactionOffset <= 0 })}>
@@ -1,8 +1,7 @@
.userList { .userList {
display: grid; display: grid;
column-gap: 16px; gap: 1rem;
grid-template-columns: repeat(5, 220px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
row-gap: 24px;
} }
.showAll { .showAll {
@@ -11,9 +10,8 @@
.productList { .productList {
display: grid; display: grid;
column-gap: 16px; gap: 1rem;
grid-template-columns: repeat(5, 220px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
row-gap: 24px;
} }
.productListSection { .productListSection {
@@ -26,9 +24,23 @@
.total { .total {
display: inline-block; display: inline-block;
min-width: 200px; min-width: min(200px, 100%);
padding: 4px 8px; padding: 4px 8px;
margin-right: 8px; margin-right: 8px;
color: white; color: white;
font-size: 1.8rem; font-size: 1.8rem;
} }
.checkout {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.75rem;
}
@media (max-width: 480px) {
.total {
width: 100%;
font-size: 1.4rem;
}
}
+14 -12
View File
@@ -1,8 +1,9 @@
import { useQuery } from "@apollo/client"; import { useQuery } from "@apollo/client";
import { Bar, BarDatum } from "@nivo/bar"; import { BarDatum, ResponsiveBar } from "@nivo/bar";
import React from "react"; import React from "react";
import { OrderStatsDocument, SchemaOrderStatsByTime } from "../../types"; import { OrderStatsDocument, SchemaOrderStatsByTime } from "../../types";
import styles from "./Stats.module.css";
import { StatsView } from "./StatsView"; import { StatsView } from "./StatsView";
import { chartTheme } from "./chartTheme"; import { chartTheme } from "./chartTheme";
@@ -24,17 +25,18 @@ const months = {
}; };
const OrderBar = ({ data }: { data: BarDatum[] }) => ( const OrderBar = ({ data }: { data: BarDatum[] }) => (
<Bar <div className={styles.chart}>
data={data} <ResponsiveBar
theme={chartTheme} data={data}
margin={{ left: 60, bottom: 40 }} theme={chartTheme}
width={1200} margin={{ top: 10, right: 10, bottom: 70, left: 60 }}
height={400} colorBy="indexValue"
colorBy="indexValue" enableLabel={false}
enableLabel={false} tooltipLabel={(d) => d.id.toString()}
tooltipLabel={(d) => d.id.toString()} axisLeft={{ legend: "Ordre", legendPosition: "middle", legendOffset: -50 }}
axisLeft={{ legend: "Ordre", legendPosition: "middle", legendOffset: -50 }} axisBottom={{ tickRotation: -35 }}
/> />
</div>
); );
const OrderStats = () => { const OrderStats = () => {
+14 -14
View File
@@ -1,5 +1,5 @@
import { useQuery } from "@apollo/client"; import { useQuery } from "@apollo/client";
import { Pie } from "@nivo/pie"; import { ResponsivePie } from "@nivo/pie";
import React from "react"; import React from "react";
import { AllProductStatsDocument } from "../../types"; import { AllProductStatsDocument } from "../../types";
@@ -23,19 +23,19 @@ const ProductStats = () => {
{(data?.allProducts || []).map((product) => ( {(data?.allProducts || []).map((product) => (
<div key={product.id}> <div key={product.id}>
{product.name} {product.name}
<Pie <div className={styles.productChart}>
margin={{ top: 40, right: 120, bottom: 40, left: 120 }} <ResponsivePie
data={product.userCounts.map((uc: UserCount) => ({ margin={{ top: 30, right: 50, bottom: 30, left: 50 }}
id: uc.name, data={product.userCounts.map((uc: UserCount) => ({
label: uc.name, id: uc.name,
value: uc.count, label: uc.name,
}))} value: uc.count,
width={400} }))}
height={300} theme={chartTheme}
theme={chartTheme} arcLabelsTextColor="#17121a"
arcLabelsTextColor="#17121a" arcLabelsSkipAngle={8}
arcLabelsSkipAngle={8} />
/> </div>
</div> </div>
))} ))}
</div> </div>
+23 -3
View File
@@ -1,8 +1,17 @@
.products { .products {
display: grid; display: grid;
max-width: 1200px; max-width: 100%;
gap: 1rem; gap: 1.5rem 1rem;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}
.productChart {
height: 300px;
}
.chart {
width: 100%;
height: 360px;
} }
.statsNav { .statsNav {
@@ -27,3 +36,14 @@
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 4px; border-radius: 4px;
} }
@media (max-width: 640px) {
.statsNav ul {
flex-wrap: wrap;
gap: 0.5rem;
}
.chart {
height: 300px;
}
}
+42 -41
View File
@@ -1,8 +1,9 @@
import { useQuery } from "@apollo/client"; import { useQuery } from "@apollo/client";
import { Line } from "@nivo/line"; import { ResponsiveLine } from "@nivo/line";
import React from "react"; import React from "react";
import { ProductStatsDocument } from "../../types"; import { ProductStatsDocument } from "../../types";
import styles from "./Stats.module.css";
import { StatsView } from "./StatsView"; import { StatsView } from "./StatsView";
import { chartTheme, chartTooltipStyle } from "./chartTheme"; import { chartTheme, chartTooltipStyle } from "./chartTheme";
@@ -20,47 +21,47 @@ const Stats = () => {
return ( return (
<StatsView loading={loading}> <StatsView loading={loading}>
<h2>Kjøp over tid</h2> <h2>Kjøp over tid</h2>
<Line <div className={styles.chart}>
data={series} <ResponsiveLine
theme={chartTheme} data={series}
width={1000} theme={chartTheme}
height={400} margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
margin={{ top: 50, right: 110, bottom: 50, left: 60 }} xScale={{
xScale={{ type: "time",
type: "time", format: "%Y-%m-%d",
format: "%Y-%m-%d", useUTC: false,
useUTC: false, precision: "day",
precision: "day", }}
}} xFormat="time:%Y-%m-%d"
xFormat="time:%Y-%m-%d" yScale={{
yScale={{ type: "linear",
type: "linear", stacked: false,
stacked: false, }}
}} axisLeft={{
axisLeft={{ legend: "Purchases",
legend: "Purchases", legendOffset: 12,
legendOffset: 12, }}
}} axisBottom={{
axisBottom={{ format: "%b %Y",
format: "%b %Y", legend: "Date",
legend: "Date", legendPosition: "middle",
legendPosition: "middle", legendOffset: -20,
legendOffset: -20, }}
}} useMesh
useMesh pointLabelYOffset={0}
pointLabelYOffset={0} tooltip={({ point }) => (
tooltip={({ point }) => ( <div style={chartTooltipStyle}>
<div style={chartTooltipStyle}> <div>
<div> <strong>{point.data.xFormatted}</strong>
<strong>{point.data.xFormatted}</strong> </div>
<div>
<span style={{ background: point.seriesColor, width: 13, height: 13, display: "inline-block" }} />{" "}
<strong>{String(point.data.yFormatted)}</strong> {point.seriesId}
</div>
</div> </div>
<div> )}
<span style={{ background: point.seriesColor, width: 13, height: 13, display: "inline-block" }} />{" "} />
<strong>{String(point.data.yFormatted)}</strong> {point.seriesId} </div>
</div>
</div>
)}
/>
</StatsView> </StatsView>
); );
}; };
@@ -1,5 +1,21 @@
.userDetail { .userDetail {
display: grid; display: grid;
min-width: 0;
gap: 1rem; gap: 1rem;
grid-template-columns: 400px 1fr; grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
}
.chart {
width: 100%;
height: 360px;
}
@media (max-width: 760px) {
.userDetail {
grid-template-columns: minmax(0, 1fr);
}
.chart {
height: 300px;
}
} }
+41 -41
View File
@@ -1,5 +1,5 @@
import { useQuery } from "@apollo/client"; import { useQuery } from "@apollo/client";
import { Line } from "@nivo/line"; import { ResponsiveLine } from "@nivo/line";
import React from "react"; import React from "react";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
@@ -61,47 +61,47 @@ const UserDetail = () => {
</div> </div>
<div> <div>
<h2>Kjøp over tid</h2> <h2>Kjøp over tid</h2>
<Line <div className={styles.chart}>
data={series} <ResponsiveLine
theme={chartTheme} data={series}
width={1000} theme={chartTheme}
height={400} margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
margin={{ top: 50, right: 110, bottom: 50, left: 60 }} xScale={{
xScale={{ type: "time",
type: "time", format: "%Y-%m-%d",
format: "%Y-%m-%d", useUTC: false,
useUTC: false, precision: "day",
precision: "day", }}
}} xFormat="time:%Y-%m-%d"
xFormat="time:%Y-%m-%d" yScale={{
yScale={{ type: "linear",
type: "linear", stacked: false,
stacked: false, }}
}} axisLeft={{
axisLeft={{ legend: "Purchases",
legend: "Purchases", legendOffset: 12,
legendOffset: 12, }}
}} axisBottom={{
axisBottom={{ format: "%b %Y",
format: "%b %Y", legend: "Date",
legend: "Date", legendPosition: "middle",
legendPosition: "middle", legendOffset: -20,
legendOffset: -20, }}
}} useMesh
useMesh pointLabelYOffset={0}
pointLabelYOffset={0} tooltip={({ point }) => (
tooltip={({ point }) => ( <div style={chartTooltipStyle}>
<div style={chartTooltipStyle}> <div>
<div> <strong>{point.data.xFormatted}</strong>
<strong>{point.data.xFormatted}</strong> </div>
<div>
<span style={{ background: point.seriesColor, width: 13, height: 13, display: "inline-block" }} />{" "}
<strong>{String(point.data.yFormatted)}</strong> {point.seriesId}
</div>
</div> </div>
<div> )}
<span style={{ background: point.seriesColor, width: 13, height: 13, display: "inline-block" }} />{" "} />
<strong>{String(point.data.yFormatted)}</strong> {point.seriesId} </div>
</div>
</div>
)}
/>
</div> </div>
</div> </div>
); );