Update dependencies

This commit is contained in:
2025-12-03 13:28:53 +01:00
parent 5ba37dca9f
commit 457060af13
25 changed files with 19171 additions and 3803 deletions
+90
View File
@@ -0,0 +1,90 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useHref, useLocation, useMatch, useNavigate } from "@remix-run/react";
const isModifiedEvent = (event) =>
!!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
const LinkContainer = ({
children,
onClick,
replace = false, // eslint-disable-line no-unused-vars
to,
state,
activeClassName = 'active',
className,
activeStyle,
style,
isActive: getIsActive,
// eslint-disable-next-line comma-dangle
...props
}) => {
const path = typeof to === 'object' ? to.pathname || '' : to;
const navigate = useNavigate();
const href = useHref(typeof to === 'string' ? { pathname: to } : to);
const match = useMatch(path);
const location = useLocation();
const child = React.Children.only(children);
const isActive = !!(getIsActive
? typeof getIsActive === 'function'
? getIsActive(match, location)
: getIsActive
: match);
const handleClick = (event) => {
if (children.props.onClick) {
children.props.onClick(event);
}
if (onClick) {
onClick(event);
}
if (
!event.defaultPrevented && // onClick prevented default
event.button === 0 && // ignore right clicks
!isModifiedEvent(event) // ignore clicks with modifier keys
) {
event.preventDefault();
navigate(to, {
replace,
state,
});
}
};
return React.cloneElement(child, {
...props,
className: [
className,
child.props.className,
isActive ? activeClassName : null,
]
.join(' ')
.trim(),
style: isActive ? { ...style, ...activeStyle } : style,
href,
onClick: handleClick,
});
};
LinkContainer.propTypes = {
children: PropTypes.element.isRequired,
onClick: PropTypes.func,
replace: PropTypes.bool,
to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
state: PropTypes.object,
className: PropTypes.string,
activeClassName: PropTypes.string,
style: PropTypes.objectOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
),
activeStyle: PropTypes.objectOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
),
isActive: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
};
export default LinkContainer;
+1 -1
View File
@@ -1,7 +1,6 @@
import { Manufacturer } from '@zenstackhq/runtime/models';
import { Alert, Badge, Button, Col, Container, Image, Row, Table } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap';
import { ContainerWithSection, DrinkComposite, containerTypeToString, isBeer, isDrinkWithContainersAndSection, isDrinkWithManufacturer, isDrinkWithStyle } from '~/models/types';
import { volume } from '~/utils/conversions';
import DrinkCard from './drink.card';
@@ -10,6 +9,7 @@ import { Link } from '@remix-run/react';
import { Bar, Chart } from 'react-chartjs-2';
import { ClientOnly } from 'remix-utils/client-only';
import 'chart.js/auto';
import LinkContainer from '../LinkContainer';
interface Arguments {
drink: DrinkComposite
+1 -2
View File
@@ -3,8 +3,7 @@ import { useSubmit } from '@remix-run/react';
import { BeerStyle, Manufacturer, WineStyle } from '@zenstackhq/runtime/models';
import { useRef, useState } from 'react';
import { Form, Col, Row, Button } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap';
import ReactSlider from 'react-slider'
import ReactSlider from 'react-slider';
import { ManufacturerWithDrinks } from '~/models/types';
interface Arguments {
+8 -22
View File
@@ -1,7 +1,7 @@
import {LinkContainer} from 'react-router-bootstrap'
import {Container, Image, Nav, Navbar, NavDropdown} from 'react-bootstrap';
import { User } from '@zenstackhq/runtime/models';
import { UserType } from '@prisma/client';
import { Link } from '@remix-run/react';
export type HeaderData = {user?: (User)} & {loggedin: boolean};
@@ -23,39 +23,25 @@ function Header(data: Arguments) {
return (
<Navbar collapseOnSelect expand="md" className="bg-body-tertiary mb-3">
<Container>
<LinkContainer to="/">
<Navbar.Brand><Image src="/favicon.ico" width="25" height="25" className="d-inline-block align-middle"></Image>FRIDGE</Navbar.Brand>
</LinkContainer>
<Navbar.Brand as={Link} to="/"><Image src="/favicon.ico" width="25" height="25" className="d-inline-block align-middle"></Image>FRIDGE</Navbar.Brand>
<Navbar.Toggle />
<Navbar.Collapse>
<Nav className="me-auto">
{ loggedin ? (
<LinkContainer to="/inventory">
<Nav.Link>Inventory</Nav.Link>
</LinkContainer>
<Nav.Link as={Link} to="/inventory">Inventory</Nav.Link>
) : "" }
<LinkContainer to="/inventory/stats">
<Nav.Link>Stats</Nav.Link>
</LinkContainer>
<LinkContainer to="/inventory/suggestions">
<Nav.Link>Suggestions</Nav.Link>
</LinkContainer>
<Nav.Link as={Link} to="/inventory/stats">Stats</Nav.Link>
<Nav.Link as={Link} to="/inventory/suggestions">Suggestions</Nav.Link>
{ showScanButtons ? (
<LinkContainer to="/scan">
<Nav.Link>Scan</Nav.Link>
</LinkContainer>
<Nav.Link as={Link} to="/scan">Scan</Nav.Link>
) : "" }
{ showAdminButtons ? (
<LinkContainer to="/admin">
<Nav.Link>Admin</Nav.Link>
</LinkContainer>
<Nav.Link as={Link} to="/admin">Admin</Nav.Link>
) : "" }
</Nav>
{ loggedin ? (
<Nav>
<LinkContainer to="/logout">
<Nav.Link>Logout ({username})</Nav.Link>
</LinkContainer>
<Nav.Link as={Link} to="/logout">Logout ({username})</Nav.Link>
</Nav>
) : (
<Nav>
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Container, Row, Col, Button, ListGroup, Badge } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Badge, Button, Col, Container, ListGroup, Row } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,11 +1,11 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Badge, Button, Col, Container, ListGroup, Row } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import { containerTypeToString } from "~/models/types";
import { volume } from "~/utils/conversions";
import timeAgo from "~/utils/datetime";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Container, Row, Col, Button, ListGroup, Badge } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,10 +1,10 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Badge, Button, Col, Container, ListGroup, Row } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import { containerTypeToString } from "~/models/types";
import { volume } from "~/utils/conversions";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Badge, Button, Col, Container, ListGroup, Row } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Badge, Button, Col, Container, ListGroup, Row } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Badge, Button, Col, Container, ListGroup, Row } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Container, Row, Col, Button, ListGroup, Badge } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Container, Row, Col, Button, ListGroup, Badge } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Container, Row, Col, Button, ListGroup, Badge } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+1 -1
View File
@@ -1,8 +1,8 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Button, Col, Container, ListGroup, Row } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
+4 -4
View File
@@ -3,13 +3,13 @@ import { Link, useLoaderData, useNavigate, useSearchParams } from "@remix-run/re
import { enhance } from "@zenstackhq/runtime";
import { useState } from "react";
import { Accordion, Button, Col, Container, Offcanvas, Row, useAccordionButton } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import DrinkCard from "~/components/cards/drink.card";
import DrinkFilter from "~/components/filters/drink.filter";
import { findDrinksFromSearch } from "~/models/drinks.filter.server";
import { findManufacturersFromSearch } from "~/models/drinks.server";
import { sortDrinksFromSearch } from "~/models/drinks.sort.server";
import LinkContainer from "~/components/LinkContainer";
import { db } from "~/utils/db.server";
import { randomRange } from "~/utils/random";
@@ -50,7 +50,7 @@ export default function BeersRoute() {
return (
<Container>
<Row className="pt-1 sticky-top bg-white mb-2" style={{boxShadow: "0px 4px 4px -5px rgba(0,0,0,.5)"}}>
<Row key="filter-sort-bar" className="pt-1 sticky-top bg-white mb-2" style={{boxShadow: "0px 4px 4px -5px rgba(0,0,0,.5)"}}>
<Col key="filtering" className="mb-3">
<div>
<Button variant="primary" onClick={handleShow}>Filters</Button>
@@ -75,7 +75,7 @@ export default function BeersRoute() {
</Offcanvas>
</Col>
</Row>
<Row>
<Row key="filter-sort-results">
<Col key="results">
<Row xs={2} md={3} lg={4} className="g-4">
{loadData.drinkResults.map((drink) => (
@@ -86,7 +86,7 @@ export default function BeersRoute() {
</Row>
</Col>
</Row>
<Row>
<Row key="filter-sort-autopick">
<Col key="pick">
<Row className="my-5">
<Col className="text-center">
+1 -2
View File
@@ -3,7 +3,6 @@ import { useLoaderData } from "@remix-run/react";
import { enhance } from "@zenstackhq/runtime";
import { Badge, Button, Col, Container, Nav, Row, Tab, Table, Tabs } from "react-bootstrap";
import { Chart, Line } from "react-chartjs-2";
import { LinkContainer } from "react-router-bootstrap";
import { ClientOnly } from "remix-utils/client-only";
import { generate24HChartData, generateMonthChartData } from "~/models/history.chart.server";
import { ContainerWithDrink, containerTypeToString } from "~/models/types";
@@ -11,7 +10,7 @@ import { volume } from "~/utils/conversions";
import timeAgo from "~/utils/datetime";
import 'chart.js/auto';
import LinkContainer from "~/components/LinkContainer";
import { db } from "~/utils/db.server";
import { generateBeerHistoryChartData, generateBeerInventoryChartData, generateTypeHistoryChartData, generateTypeInventoryChartData } from "~/models/type.chart.server";
import { drinkTypeToColor } from "~/utils/color";
+1 -1
View File
@@ -1,9 +1,9 @@
import { ActionFunctionArgs, EntryContext, LoaderFunctionArgs, MetaFunction, json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Button, Col, Container, Form, Row, Table } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import timeAgo from "~/utils/datetime";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
export const action = async ({
+1 -1
View File
@@ -2,8 +2,8 @@ import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { Button, Container, Form, Row } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import LinkContainer from "~/components/LinkContainer";
import { enhance } from "~/utils/db.server";
export async function loader({
+5096 -3682
View File
File diff suppressed because it is too large Load Diff
+13921
View File
File diff suppressed because it is too large Load Diff
+29 -31
View File
@@ -11,47 +11,45 @@
"typecheck": "tsc"
},
"dependencies": {
"@prisma/client": "^5.13.0",
"@remix-run/node": "^2.9.1",
"@remix-run/react": "^2.9.1",
"@remix-run/serve": "^2.9.1",
"@prisma/client": "^6.8.2",
"@remix-run/node": "^2.16.7",
"@remix-run/react": "^2.16.7",
"@remix-run/serve": "^2.16.7",
"@uidotdev/usehooks": "^2.4.1",
"@zenstackhq/runtime": "2.1.2",
"bootstrap": "^5.3.3",
"isbot": "^4.1.0",
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.8.2",
"@zenstackhq/runtime": "2.15.0",
"bootstrap": "^5.3.6",
"isbot": "^5.1.28",
"jspdf": "^3.0.1",
"jspdf-autotable": "^5.0.2",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-bootstrap": "^2.10.2",
"react-chartjs-2": "^5.2.0",
"react-bootstrap": "^2.10.10",
"react-chartjs-2": "^5.3.0",
"react-dom": "^18.2.0",
"react-router-bootstrap": "^0.26.2",
"react-slider": "^2.0.6",
"remix-utils": "^7.6.0",
"tsx": "^4.7.3"
"remix-utils": "^7.7.0",
"tsx": "^4.19.4"
},
"devDependencies": {
"@remix-run/dev": "^2.9.1",
"@tailwindcss/forms": "^0.5.7",
"@types/lodash": "^4.17.1",
"@remix-run/dev": "^2.16.7",
"@tailwindcss/forms": "^0.5.10",
"@types/lodash": "^4.17.17",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@types/react-router-bootstrap": "^0.26.6",
"@types/react-slider": "^1.3.6",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.38.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prisma": "^5.13.0",
"typescript": "^5.4.5",
"vite": "^5.1.0",
"vite-tsconfig-paths": "^4.2.1",
"zenstack": "2.1.2"
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"eslint": "^9.27.0",
"eslint-import-resolver-typescript": "^4.4.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"prisma": "^6.8.2",
"typescript": "^5.8.3",
"vite": "^6.3.5",
"vite-tsconfig-paths": "^5.1.4",
"zenstack": "^2.15.0"
},
"engines": {
"node": ">=18.0.0"
-43
View File
@@ -35,9 +35,6 @@ enum ContainerType {
Keg
}
/// @@delegate(type)
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model Drink {
id Int @id() @default(autoincrement())
slug String @unique()
@@ -60,10 +57,6 @@ model Drink {
delegate_aux_cocktail Cocktail?
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model Beer {
id Int @id()
style_id Int
@@ -73,8 +66,6 @@ model Beer {
delegate_aux_drink Drink @relation(fields: [id], references: [id], onDelete: Cascade, onUpdate: Cascade)
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model BeerStyle {
id Int @id() @default(autoincrement())
name String @unique()
@@ -82,10 +73,6 @@ model BeerStyle {
beers Beer[]
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model Wine {
id Int @id()
style_id Int
@@ -98,8 +85,6 @@ model Wine {
delegate_aux_drink Drink @relation(fields: [id], references: [id], onDelete: Cascade, onUpdate: Cascade)
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model WineStyle {
id Int @id() @default(autoincrement())
name String @unique()
@@ -107,29 +92,18 @@ model WineStyle {
wines Wine[]
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model Soda {
id Int @id()
carbonated Boolean
delegate_aux_drink Drink @relation(fields: [id], references: [id], onDelete: Cascade, onUpdate: Cascade)
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model Cocktail {
id Int @id()
mix Boolean
delegate_aux_drink Drink @relation(fields: [id], references: [id], onDelete: Cascade, onUpdate: Cascade)
}
/// @@allow('read', true)
/// @@allow('update', auth() != null)
/// @@allow('all', auth().type == Admin)
model Container {
id Int @id() @default(autoincrement())
barcode String? @unique()
@@ -145,16 +119,12 @@ model Container {
checkouts History[]
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model Section {
id Int @id() @default(autoincrement())
name String @unique()
containers Container[]
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model Manufacturer {
id Int @id() @default(autoincrement())
country_id String
@@ -165,17 +135,12 @@ model Manufacturer {
drinks Drink[]
}
/// @@allow('read', true)
/// @@allow('all', auth().type == Admin)
model Country {
code String @id()
name String
manufacturers Manufacturer[]
}
/// @@allow('read', true)
/// @@allow('create', auth().type == Scanner)
/// @@allow('all', auth().type == Admin)
model History {
id Int @id() @default(autoincrement())
container_id Int
@@ -184,20 +149,14 @@ model History {
inventoryAfter Int
}
/// @@allow('all', auth() == this)
/// @@allow('all', auth().type == Admin)
model User {
id Int @id() @default(autoincrement())
username String @unique()
/// @password
/// @omit
password String
type UserType
sessions Session[]
}
/// @@allow('all', auth().id == user.id)
/// @@allow('all', auth().type == Admin)
model Session {
id String @id() @default(uuid())
createdAt DateTime @default(now())
@@ -206,7 +165,6 @@ model Session {
data String
}
/// @@allow('all', true)
model Suggestion {
id Int @id() @default(autoincrement())
createdAt DateTime @default(now())
@@ -215,7 +173,6 @@ model Suggestion {
resolved Boolean @default(false)
}
/// @@allow('all', auth().type == Admin)
model Report {
id Int @id() @default(autoincrement())
createdAt DateTime @default(now())
+6 -2
View File
@@ -5,8 +5,7 @@
"**/.server/**/*.ts",
"**/.server/**/*.tsx",
"**/.client/**/*.ts",
"**/.client/**/*.tsx"
],
"**/.client/**/*.tsx" ],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"types": ["@remix-run/node", "vite/client"],
@@ -19,6 +18,11 @@
"target": "ES2022",
"strict": true,
"allowJs": true,
"linterOptions": {
"exclude": [
"**/*.js"
]
},
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",