fix mobile

This commit is contained in:
Mateusz Gruszczyński
2026-03-26 23:03:11 +01:00
parent 6db6d2822e
commit b01259bc5f
4 changed files with 1874 additions and 25 deletions

View File

@@ -504,6 +504,7 @@ export default function App() {
const [theme, setTheme] = useState<ThemeMode>(() => getInitialTheme(undefined));
const [language, setLanguage] = useState<Language>(() => getInitialLanguage(undefined));
const [activeTab, setActiveTab] = useState<TabKey>(publicMode ? "kiosk" : "realtime");
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const [realtimeRange, setRealtimeRange] = useState("today");
const [analyticsRange, setAnalyticsRange] = useState("30d");
const [bucket, setBucket] = useState("day");
@@ -571,6 +572,7 @@ export default function App() {
useEffect(() => { writeStorage(STORAGE_KEYS.liveMetrics, liveMetrics); }, [liveMetrics]);
useEffect(() => { writeStorage(STORAGE_KEYS.archiveMetrics, archiveMetrics); }, [archiveMetrics]);
useEffect(() => { writeStorage(STORAGE_KEYS.liveAutoRefresh, String(liveAutoRefresh)); }, [liveAutoRefresh]);
useEffect(() => { setMobileMenuOpen(false); }, [activeTab, viewMode]);
const dataEnabled = authenticated || authEnabled === false;
const currentRole = publicMode ? null : (authQuery.data?.role ?? null);
@@ -772,8 +774,8 @@ export default function App() {
{!publicMode && currentRole ? <span className={`badge ${isAdmin ? "bg-primary-lt text-primary" : "bg-azure-lt text-azure"}`}>{currentRole}</span> : null}
<button className="btn btn-icon btn-ghost-secondary" onClick={() => setTheme((current) => (current === "dark" ? "light" : "dark"))} title={t(language, "theme")}>{theme === "dark" ? <IconSun size={18} /> : <IconMoon size={18} />}</button>
<button className="btn btn-icon btn-ghost-secondary" onClick={() => setLanguage((current) => (current === "pl" ? "en" : "pl"))} title={t(language, "language")}><IconLanguage size={18} /></button>
{!publicMode ? <button className="btn btn-sm pv-navbar-action" onClick={() => setViewMode((current) => (current === "normal" ? "kiosk" : "normal"))}><IconDeviceDesktop size={16} className="me-1" />{viewMode === "normal" ? t(language, "openKiosk") : t(language, "exitKiosk")}</button> : null}
{!publicMode ? <button className="btn btn-sm pv-navbar-action" onClick={() => logoutMutation.mutate()}><IconLogout size={16} className="me-1" />{t(language, "signOut")}</button> : null}
{!publicMode ? <button className="btn btn-sm pv-navbar-action" onClick={() => setViewMode((current) => (current === "normal" ? "kiosk" : "normal"))} aria-label={viewMode === "normal" ? t(language, "openKiosk") : t(language, "exitKiosk")} title={viewMode === "normal" ? t(language, "openKiosk") : t(language, "exitKiosk")}><span className="pv-navbar-action-icon"><IconDeviceDesktop size={16} /></span><span className="pv-navbar-action-label">{viewMode === "normal" ? t(language, "openKiosk") : t(language, "exitKiosk")}</span></button> : null}
{!publicMode ? <button className="btn btn-sm pv-navbar-action" onClick={() => logoutMutation.mutate()} aria-label={t(language, "signOut")} title={t(language, "signOut")}><span className="pv-navbar-action-icon"><IconLogout size={16} /></span><span className="pv-navbar-action-label">{t(language, "signOut")}</span></button> : null}
</div>
</div>
</header>
@@ -794,13 +796,33 @@ export default function App() {
const menu = (
<div className="pv-subnav border-bottom">
<div className="container-xl">
<div className="pv-subnav-shell d-flex flex-wrap align-items-center justify-content-between gap-3 py-2">
<div className="d-flex flex-wrap gap-2">
<div className="pv-subnav-shell py-2">
<div className="pv-subnav-mobile-top">
<button
className={`btn pv-mobile-menu-toggle ${mobileMenuOpen ? "active" : ""}`}
onClick={() => setMobileMenuOpen((current) => !current)}
aria-expanded={mobileMenuOpen}
aria-label={language === "en" ? "Toggle navigation menu" : "Przełącz menu nawigacji"}
>
<span className="pv-mobile-menu-toggle-icon" aria-hidden="true">
<span />
<span />
<span />
</span>
<span>{language === "en" ? "Menu" : "Menu"}</span>
</button>
{subnavRefreshControls}
</div>
<div className={`pv-subnav-main ${mobileMenuOpen ? "is-open" : ""}`}>
<div className="pv-subnav-tabs">
{menuTabs.map((item) => (
<button
key={item.id}
className={`btn pv-menu-tab ${activeTab === item.id ? "active" : ""}`}
onClick={() => setActiveTab(item.id)}
onClick={() => {
setActiveTab(item.id);
setMobileMenuOpen(false);
}}
>
<span className="pv-menu-tab-icon">{item.icon}</span>
<span>{item.label}</span>
@@ -808,7 +830,7 @@ export default function App() {
))}
</div>
<div className="pv-subnav-side">
{subnavRefreshControls}
<div className="pv-subnav-refresh-desktop">{subnavRefreshControls}</div>
<div className="pv-menu-meta">
<IconClockHour4 size={16} />
<span>{t(language, "updatedAt")}: {formatDateTime(lastUpdated, locale)}</span>
@@ -817,6 +839,7 @@ export default function App() {
</div>
</div>
</div>
</div>
);
if (viewMode === "kiosk" || publicMode) {

File diff suppressed because one or more lines are too long

View File

@@ -111,6 +111,16 @@ body {
.page-body {
padding-top: 0.75rem;
}
.pv-navbar-action {
gap: 0;
min-width: 2.5rem;
padding-inline: 0.7rem !important;
}
.pv-navbar-action-label {
display: none;
}
}
@@ -158,6 +168,28 @@ body {
background: rgba(127, 127, 127, 0.18) !important;
}
.pv-navbar-action {
display: inline-flex !important;
align-items: center;
justify-content: center;
gap: 0.45rem;
min-width: 0;
}
.pv-navbar-action-icon {
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
line-height: 1;
}
.pv-navbar-action-label {
display: inline-flex;
align-items: center;
white-space: nowrap;
}
.pv-filter-grid {
display: grid;
grid-template-columns: repeat(3, minmax(180px, 1fr));
@@ -220,6 +252,28 @@ body {
min-height: 4rem;
}
.pv-subnav-mobile-top {
display: none;
}
.pv-subnav-main {
display: flex;
flex: 1 1 auto;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 0.85rem;
width: 100%;
min-width: 0;
}
.pv-subnav-tabs {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
min-width: 0;
}
.pv-menu-tab {
display: inline-flex !important;
align-items: center;
@@ -262,6 +316,11 @@ body {
margin-left: auto;
}
.pv-subnav-refresh-desktop {
display: flex;
min-width: 0;
}
.pv-subnav-refresh-group {
display: flex;
flex-wrap: wrap;
@@ -281,30 +340,128 @@ body {
min-width: 0;
}
.pv-mobile-menu-toggle {
display: none !important;
align-items: center;
gap: 0.65rem;
border-color: transparent !important;
border-radius: 0.85rem !important;
padding: 0.7rem 0.9rem !important;
background: rgba(127, 127, 127, 0.1) !important;
color: inherit !important;
font-weight: 600;
}
.pv-mobile-menu-toggle:hover,
.pv-mobile-menu-toggle:focus,
.pv-mobile-menu-toggle.active {
background: rgba(127, 127, 127, 0.16) !important;
}
.pv-mobile-menu-toggle-icon {
display: inline-flex;
flex-direction: column;
justify-content: center;
gap: 0.2rem;
width: 1rem;
min-width: 1rem;
}
.pv-mobile-menu-toggle-icon span {
display: block;
width: 100%;
height: 2px;
border-radius: 999px;
background: currentColor;
transform-origin: center;
transition: transform 0.18s ease, opacity 0.18s ease;
}
.pv-mobile-menu-toggle.active .pv-mobile-menu-toggle-icon span:nth-child(1) {
transform: translateY(5px) rotate(45deg);
}
.pv-mobile-menu-toggle.active .pv-mobile-menu-toggle-icon span:nth-child(2) {
opacity: 0;
}
.pv-mobile-menu-toggle.active .pv-mobile-menu-toggle-icon span:nth-child(3) {
transform: translateY(-5px) rotate(-45deg);
}
@media (max-width: 1200px) {
.pv-subnav-side {
width: 100%;
justify-content: space-between;
margin-left: 0;
}
}
@media (max-width: 992px) {
@media (max-width: 768px) {
.pv-subnav-shell {
min-height: auto;
}
.pv-subnav-mobile-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.75rem;
flex-wrap: wrap;
}
.pv-mobile-menu-toggle {
display: inline-flex !important;
}
.pv-subnav-main {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 0.75rem;
margin-top: 0.75rem;
}
.pv-subnav-tabs {
display: none;
width: 100%;
flex-direction: column;
gap: 0.5rem;
}
.pv-subnav-main.is-open .pv-subnav-tabs {
display: flex;
}
.pv-menu-tab {
width: 100%;
justify-content: flex-start;
border-radius: 0.9rem !important;
padding: 0.75rem 0.95rem !important;
}
.pv-subnav-side {
width: 100%;
flex-direction: column;
align-items: stretch;
gap: 0.75rem;
margin-left: 0;
}
.pv-subnav-refresh-group {
width: 100%;
flex-direction: column;
align-items: stretch;
.pv-subnav-refresh-desktop {
display: none;
}
.pv-subnav-mobile-top .pv-subnav-refresh-group {
flex: 1 1 220px;
justify-content: flex-end;
}
.pv-menu-meta {
width: 100%;
justify-content: center;
justify-content: flex-start;
white-space: normal;
font-size: 0.8125rem;
}
}

View File

@@ -0,0 +1,631 @@
:root {
--tblr-border-radius: 0.55rem;
--tblr-border-radius-lg: 0.7rem;
--tblr-border-radius-sm: 0.4rem;
--tblr-card-border-radius: 0.7rem;
--tblr-shadow-sm: 0 0.125rem 0.25rem rgba(15, 23, 42, 0.05);
--pv-shell-bg: #f4f6f9;
--pv-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 24px rgba(15, 23, 42, 0.04);
}
[data-bs-theme="dark"] {
--pv-shell-bg: #0b1220;
--pv-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 14px 30px rgba(0, 0, 0, 0.24);
}
html,
body,
#root {
min-height: 100%;
}
body {
background: var(--pv-shell-bg);
}
.page {
min-height: 100vh;
}
.page-body {
padding-top: 1rem;
padding-bottom: 1.5rem;
}
.pv-navbar,
.pv-subnav {
backdrop-filter: blur(14px);
}
.pv-card,
.login-card {
border-width: 1px;
box-shadow: var(--pv-card-shadow);
}
.pv-card .card-header,
.pv-card .card-body,
.login-card .card-body {
padding: 1rem 1rem;
}
.pv-hero-card .display-6 {
letter-spacing: -0.03em;
}
.pv-chart {
width: 100%;
height: 340px;
}
.pv-chart-sm {
width: 100%;
height: 280px;
}
.status-row,
.string-panel {
background: rgba(127, 127, 127, 0.03);
}
.kiosk-shell {
background:
radial-gradient(circle at top right, rgba(32, 107, 196, 0.08), transparent 30%),
var(--pv-shell-bg);
}
.login-page-shell {
background:
radial-gradient(circle at top, rgba(32, 107, 196, 0.12), transparent 28%),
var(--pv-shell-bg);
}
.btn-group > .btn,
.form-control,
.card,
.border,
.progress,
.badge,
.alert {
border-radius: 0.65rem !important;
}
.card-table tbody tr:last-child td {
border-bottom-width: 0;
}
.nav-link.active {
font-weight: 600;
}
.table-responsive {
overflow-x: auto;
}
@media (max-width: 768px) {
.pv-chart,
.pv-chart-sm {
height: 260px;
}
.page-body {
padding-top: 0.75rem;
}
}
.pv-nav-link {
display: inline-flex !important;
align-items: center;
justify-content: center;
gap: 0.1rem;
min-height: 1.75rem;
padding: 0.5rem 0.5rem !important;
}
.pv-nav-icon {
width: 1rem;
min-width: 1rem;
height: 1rem;
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 1.1rem;
line-height: 1;
}
.pv-nav-icon svg {
display: block;
width: 1.1rem;
height: 1.1rem;
}
.pv-nav-title {
display: inline-flex;
align-items: center;
line-height: 1.1;
white-space: nowrap;
}
.pv-navbar-action {
border-color: transparent !important;
background: rgba(127, 127, 127, 0.1) !important;
color: inherit !important;
}
.pv-navbar-action:hover,
.pv-navbar-action:focus {
background: rgba(127, 127, 127, 0.18) !important;
}
.pv-filter-grid {
display: grid;
grid-template-columns: repeat(3, minmax(180px, 1fr));
gap: 0.75rem;
align-items: end;
}
.pv-filter-grid-live {
grid-template-columns: minmax(260px, 1.45fr) minmax(240px, 0.92fr) minmax(210px, 0.95fr);
}
.pv-filter-grid-archive {
grid-template-columns: minmax(240px, 1.35fr) minmax(180px, 0.9fr) repeat(2, minmax(160px, 1fr));
}
.pv-segmented {
min-width: 0;
}
.pv-segmented-label {
margin-bottom: 0.35rem;
font-size: 0.75rem;
color: var(--tblr-secondary);
}
.pv-segmented-group {
display: flex !important;
flex-wrap: wrap;
gap: 0.45rem;
}
.pv-segmented-group > .btn {
border-radius: 0.65rem !important;
flex: 1 0 auto;
}
.pv-filter-field {
min-width: 0;
}
@media (max-width: 992px) {
.pv-filter-grid,
.pv-filter-grid-live,
.pv-filter-grid-archive {
grid-template-columns: 1fr;
}
}
.pv-card .btn.text-start {
white-space: normal;
}
.text-break {
word-break: break-word;
}
.pv-subnav-shell {
min-height: 4rem;
}
.pv-menu-tab {
display: inline-flex !important;
align-items: center;
gap: 0.55rem;
border: 1px solid transparent !important;
border-radius: 999px !important;
padding: 0.6rem 0.95rem !important;
background: rgba(127, 127, 127, 0.08) !important;
color: inherit !important;
font-weight: 500;
}
.pv-menu-tab:hover,
.pv-menu-tab:focus {
background: rgba(127, 127, 127, 0.14) !important;
}
.pv-menu-tab.active {
background: rgba(32, 107, 196, 0.14) !important;
border-color: rgba(32, 107, 196, 0.22) !important;
color: var(--tblr-primary) !important;
box-shadow: 0 0 0 1px rgba(32, 107, 196, 0.06) inset;
}
.pv-menu-tab-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.1rem;
min-width: 1.1rem;
}
.pv-subnav-side {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 0.85rem;
min-width: 0;
margin-left: auto;
}
.pv-subnav-refresh-group {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 0.5rem;
min-width: 0;
}
.pv-menu-meta {
display: inline-flex;
align-items: center;
gap: 0.45rem;
color: var(--tblr-secondary);
font-size: 0.875rem;
white-space: nowrap;
min-width: 0;
}
@media (max-width: 1200px) {
.pv-subnav-side {
width: 100%;
justify-content: space-between;
}
}
@media (max-width: 992px) {
.pv-subnav-side {
width: 100%;
flex-direction: column;
align-items: stretch;
}
.pv-subnav-refresh-group {
width: 100%;
flex-direction: column;
align-items: stretch;
}
.pv-menu-meta {
width: 100%;
justify-content: center;
white-space: normal;
}
}
.pv-date-field,
.pv-filter-field {
min-width: 0;
}
.pv-date-input {
min-height: 2.8rem;
font-size: 0.95rem;
}
.pv-action-tile,
.pv-chip-button {
border-radius: 0.9rem !important;
}
.pv-order-card {
border: 1px solid var(--tblr-border-color, rgba(15, 23, 42, 0.12));
border-radius: 1rem;
padding: 0.9rem 1rem;
background: color-mix(in srgb, var(--tblr-bg-surface, #fff) 90%, transparent);
}
.pv-order-index {
width: 2rem;
min-width: 2rem;
height: 2rem;
border-radius: 999px;
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 700;
background: rgba(32, 107, 196, 0.12);
color: var(--tblr-primary, #206bc4);
}
@media (max-width: 992px) {
.page-header .col-auto.ms-auto {
width: 100%;
}
}
@media (max-width: 576px) {
.pv-segmented-group {
display: grid !important;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.pv-segmented-group > .btn,
.pv-chip-button,
.pv-action-tile,
.pv-order-card .btn {
width: 100%;
}
.pv-filter-grid-archive {
grid-template-columns: 1fr;
}
.pv-date-input {
min-height: 3rem;
}
.pv-order-card .btn-list {
width: 100%;
display: grid;
grid-template-columns: 1fr;
gap: 0.5rem;
}
}
.login-layout {
min-height: 72vh;
}
.login-card-enhanced {
overflow: hidden;
border-width: 1px;
}
.login-card-enhanced::before {
content: "";
position: absolute;
inset: 0 0 auto 0;
height: 5px;
background: linear-gradient(90deg, rgba(32, 107, 196, 0.95), rgba(47, 179, 68, 0.9));
}
.login-card-enhanced .card-body {
position: relative;
}
.login-showcase-card {
border: 1px solid rgba(32, 107, 196, 0.14);
border-radius: 1rem;
padding: 2rem;
background:
radial-gradient(circle at top right, rgba(32, 107, 196, 0.18), transparent 30%),
rgba(255, 255, 255, 0.74);
box-shadow: var(--pv-card-shadow);
}
[data-bs-theme="dark"] .login-showcase-card {
background:
radial-gradient(circle at top right, rgba(32, 107, 196, 0.22), transparent 32%),
rgba(11, 18, 32, 0.82);
border-color: rgba(148, 163, 184, 0.18);
}
.login-showcase-badge {
display: inline-flex;
align-items: center;
gap: 0.4rem;
padding: 0.45rem 0.75rem;
border-radius: 999px;
background: rgba(32, 107, 196, 0.12);
color: #206bc4;
font-size: 0.8rem;
font-weight: 600;
margin-bottom: 1rem;
}
.login-showcase-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.85rem;
}
.login-stat-card {
padding: 1rem;
border-radius: 0.9rem;
border: 1px solid rgba(148, 163, 184, 0.18);
background: rgba(255, 255, 255, 0.78);
}
[data-bs-theme="dark"] .login-stat-card {
background: rgba(15, 23, 42, 0.84);
border-color: rgba(148, 163, 184, 0.14);
}
.login-input-stack {
display: flex;
flex-direction: column;
gap: 1rem;
}
.login-submit-button {
margin-top: 0.25rem;
}
.login-footer-note {
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid rgba(148, 163, 184, 0.18);
color: var(--tblr-secondary);
font-size: 0.88rem;
}
.pv-page-header-actions {
width: 100%;
display: flex;
justify-content: flex-end;
}
.pv-page-header-actions--wide {
width: min(100%, 920px);
margin-left: auto;
}
.pv-page-header-actions--right {
justify-items: end;
align-items: end;
}
.pv-page-header-actions--right > :first-child {
justify-self: stretch;
}
.pv-page-header-range-grid {
display: grid;
grid-template-columns: minmax(260px, 1fr) minmax(220px, 0.92fr);
gap: 0.75rem;
width: min(100%, 620px);
}
.pv-page-header-range-grid--single {
grid-template-columns: minmax(280px, 1fr);
width: min(100%, 420px);
}
.pv-refresh-panel {
min-width: 240px;
}
.pv-refresh-panel--compact {
width: min(100%, 176px);
min-width: 0;
}
.pv-refresh-switch {
position: relative;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
align-items: center;
width: 100%;
min-height: 3rem;
padding: 0.28rem;
border: 1px solid color-mix(in srgb, var(--tblr-border-color, rgba(148, 163, 184, 0.2)) 90%, transparent);
border-radius: 999px;
background: color-mix(in srgb, var(--tblr-bg-surface, #fff) 88%, rgba(32, 107, 196, 0.05));
color: var(--tblr-secondary);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
overflow: hidden;
transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.pv-refresh-switch:hover,
.pv-refresh-switch:focus-visible {
border-color: color-mix(in srgb, var(--tblr-primary, #206bc4) 36%, var(--tblr-border-color, rgba(148, 163, 184, 0.18)));
box-shadow: 0 0 0 0.12rem rgba(32, 107, 196, 0.12);
}
.pv-refresh-panel--compact .pv-refresh-switch {
min-height: 2.5rem;
padding: 0.18rem;
}
.pv-refresh-switch-thumb {
position: absolute;
top: 0.28rem;
bottom: 0.28rem;
left: 0.28rem;
width: calc(50% - 0.28rem);
border-radius: 999px;
background: linear-gradient(135deg, rgba(32, 107, 196, 0.96), rgba(52, 118, 220, 0.86));
box-shadow: 0 10px 24px rgba(32, 107, 196, 0.2);
transition: transform 0.22s ease;
}
.pv-refresh-switch.is-paused .pv-refresh-switch-thumb {
transform: translateX(100%);
background: linear-gradient(135deg, rgba(100, 116, 139, 0.96), rgba(71, 85, 105, 0.86));
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}
.pv-refresh-switch-option {
position: relative;
z-index: 1;
min-width: 0;
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 2.35rem;
padding: 0 0.75rem;
font-size: 0.92rem;
font-weight: 700;
color: var(--tblr-secondary);
transition: color 0.18s ease, opacity 0.18s ease;
}
.pv-refresh-panel--compact .pv-refresh-switch-thumb {
top: 0.18rem;
bottom: 0.18rem;
left: 0.18rem;
width: calc(50% - 0.18rem);
}
.pv-refresh-panel--compact .pv-refresh-switch-option {
min-height: 1.95rem;
padding: 0 0.7rem;
font-size: 0.84rem;
}
.pv-refresh-switch.is-auto .pv-refresh-switch-option--auto,
.pv-refresh-switch.is-paused .pv-refresh-switch-option--paused {
color: #fff;
}
.pv-refresh-switch.is-auto .pv-refresh-switch-option--paused,
.pv-refresh-switch.is-paused .pv-refresh-switch-option--auto {
opacity: 0.82;
}
.pv-chart-footer-controls {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(220px, 1.1fr);
gap: 0.85rem;
align-items: end;
}
.pv-chart-footer-status {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
@media (max-width: 992px) {
.pv-chart-footer-controls,
.pv-page-header-range-grid,
.pv-page-header-range-grid--single {
grid-template-columns: 1fr;
width: 100%;
}
.pv-page-header-actions,
.pv-page-header-actions--wide {
width: 100%;
}
}
@media (max-width: 576px) {
.pv-refresh-panel {
min-width: 0;
}
.pv-refresh-switch-option {
font-size: 0.88rem;
padding: 0 0.55rem;
}
}