Add Ruimtemodel Stadslogistiek webapp with three layout views
Full Next.js webapp implementing the urban logistics space model with: - Three switchable layouts: Rebel Excel, DMI Cockpit, and Webapp - Monte Carlo simulation engine for logistics space estimation - Draggable floating layout switcher - Partner logos and branding assets - EUPL-1.2 license (matching the original xlsm model) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@@ -0,0 +1,292 @@
|
||||
EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
||||
EUPL © the European Union 2007, 2016
|
||||
|
||||
This European Union Public Licence (the ‘EUPL’) applies to the Work (as
|
||||
defined below) which is provided under the terms of this Licence. Any use of
|
||||
the Work, other than as authorised under this Licence is prohibited (to the
|
||||
extent such use is covered by a right of the copyright holder of the Work).
|
||||
|
||||
The Work is provided under the terms of this Licence when the Licensor (as
|
||||
defined below) has placed the following notice immediately following the
|
||||
copyright notice for the Work:
|
||||
|
||||
Licensed under the EUPL
|
||||
|
||||
or has expressed by any other means his willingness to license under the EUPL.
|
||||
|
||||
1. Definitions
|
||||
|
||||
In this Licence, the following terms have the following meaning:
|
||||
|
||||
- ‘The Licence’: this Licence.
|
||||
|
||||
- ‘The Original Work’: the work or software distributed or communicated by the
|
||||
Licensor under this Licence, available as Source Code and also as Executable
|
||||
Code as the case may be.
|
||||
|
||||
- ‘Derivative Works’: the works or software that could be created by the
|
||||
Licensee, based upon the Original Work or modifications thereof. This
|
||||
Licence does not define the extent of modification or dependence on the
|
||||
Original Work required in order to classify a work as a Derivative Work;
|
||||
this extent is determined by copyright law applicable in the country
|
||||
mentioned in Article 15.
|
||||
|
||||
- ‘The Work’: the Original Work or its Derivative Works.
|
||||
|
||||
- ‘The Source Code’: the human-readable form of the Work which is the most
|
||||
convenient for people to study and modify.
|
||||
|
||||
- ‘The Executable Code’: any code which has generally been compiled and which
|
||||
is meant to be interpreted by a computer as a program.
|
||||
|
||||
- ‘The Licensor’: the natural or legal person that distributes or communicates
|
||||
the Work under the Licence.
|
||||
|
||||
- ‘Contributor(s)’: any natural or legal person who modifies the Work under
|
||||
the Licence, or otherwise contributes to the creation of a Derivative Work.
|
||||
|
||||
- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
|
||||
the Work under the terms of the Licence.
|
||||
|
||||
- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
|
||||
renting, distributing, communicating, transmitting, or otherwise making
|
||||
available, online or offline, copies of the Work or providing access to its
|
||||
essential functionalities at the disposal of any other natural or legal
|
||||
person.
|
||||
|
||||
2. Scope of the rights granted by the Licence
|
||||
|
||||
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||
sublicensable licence to do the following, for the duration of copyright
|
||||
vested in the Original Work:
|
||||
|
||||
- use the Work in any circumstance and for all usage,
|
||||
- reproduce the Work,
|
||||
- modify the Work, and make Derivative Works based upon the Work,
|
||||
- communicate to the public, including the right to make available or display
|
||||
the Work or copies thereof to the public and perform publicly, as the case
|
||||
may be, the Work,
|
||||
- distribute the Work or copies thereof,
|
||||
- lend and rent the Work or copies thereof,
|
||||
- sublicense rights in the Work or copies thereof.
|
||||
|
||||
Those rights can be exercised on any media, supports and formats, whether now
|
||||
known or later invented, as far as the applicable law permits so.
|
||||
|
||||
In the countries where moral rights apply, the Licensor waives his right to
|
||||
exercise his moral right to the extent allowed by law in order to make
|
||||
effective the licence of the economic rights here above listed.
|
||||
|
||||
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights
|
||||
to any patents held by the Licensor, to the extent necessary to make use of
|
||||
the rights granted on the Work under this Licence.
|
||||
|
||||
3. Communication of the Source Code
|
||||
|
||||
The Licensor may provide the Work either in its Source Code form, or as
|
||||
Executable Code. If the Work is provided as Executable Code, the Licensor
|
||||
provides in addition a machine-readable copy of the Source Code of the Work
|
||||
along with each copy of the Work that the Licensor distributes or indicates,
|
||||
in a notice following the copyright notice attached to the Work, a repository
|
||||
where the Source Code is easily and freely accessible for as long as the
|
||||
Licensor continues to distribute or communicate the Work.
|
||||
|
||||
4. Limitations on copyright
|
||||
|
||||
Nothing in this Licence is intended to deprive the Licensee of the benefits
|
||||
from any exception or limitation to the exclusive rights of the rights owners
|
||||
in the Work, of the exhaustion of those rights or of other applicable
|
||||
limitations thereto.
|
||||
|
||||
5. Obligations of the Licensee
|
||||
|
||||
The grant of the rights mentioned above is subject to some restrictions and
|
||||
obligations imposed on the Licensee. Those obligations are the following:
|
||||
|
||||
Attribution right: The Licensee shall keep intact all copyright, patent or
|
||||
trademarks notices and all notices that refer to the Licence and to the
|
||||
disclaimer of warranties. The Licensee must include a copy of such notices and
|
||||
a copy of the Licence with every copy of the Work he/she distributes or
|
||||
communicates. The Licensee must cause any Derivative Work to carry prominent
|
||||
notices stating that the Work has been modified and the date of modification.
|
||||
|
||||
Copyleft clause: If the Licensee distributes or communicates copies of the
|
||||
Original Works or Derivative Works, this Distribution or Communication will be
|
||||
done under the terms of this Licence or of a later version of this Licence
|
||||
unless the Original Work is expressly distributed only under this version of
|
||||
the Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
|
||||
(becoming Licensor) cannot offer or impose any additional terms or conditions
|
||||
on the Work or Derivative Work that alter or restrict the terms of the
|
||||
Licence.
|
||||
|
||||
Compatibility clause: If the Licensee Distributes or Communicates Derivative
|
||||
Works or copies thereof based upon both the Work and another work licensed
|
||||
under a Compatible Licence, this Distribution or Communication can be done
|
||||
under the terms of this Compatible Licence. For the sake of this clause,
|
||||
‘Compatible Licence’ refers to the licences listed in the appendix attached to
|
||||
this Licence. Should the Licensee's obligations under the Compatible Licence
|
||||
conflict with his/her obligations under this Licence, the obligations of the
|
||||
Compatible Licence shall prevail.
|
||||
|
||||
Provision of Source Code: When distributing or communicating copies of the
|
||||
Work, the Licensee will provide a machine-readable copy of the Source Code or
|
||||
indicate a repository where this Source will be easily and freely available
|
||||
for as long as the Licensee continues to distribute or communicate the Work.
|
||||
|
||||
Legal Protection: This Licence does not grant permission to use the trade
|
||||
names, trademarks, service marks, or names of the Licensor, except as required
|
||||
for reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the copyright notice.
|
||||
|
||||
6. Chain of Authorship
|
||||
|
||||
The original Licensor warrants that the copyright in the Original Work granted
|
||||
hereunder is owned by him/her or licensed to him/her and that he/she has the
|
||||
power and authority to grant the Licence.
|
||||
|
||||
Each Contributor warrants that the copyright in the modifications he/she
|
||||
brings to the Work are owned by him/her or licensed to him/her and that he/she
|
||||
has the power and authority to grant the Licence.
|
||||
|
||||
Each time You accept the Licence, the original Licensor and subsequent
|
||||
Contributors grant You a licence to their contributions to the Work, under the
|
||||
terms of this Licence.
|
||||
|
||||
7. Disclaimer of Warranty
|
||||
|
||||
The Work is a work in progress, which is continuously improved by numerous
|
||||
Contributors. It is not a finished work and may therefore contain defects or
|
||||
‘bugs’ inherent to this type of development.
|
||||
|
||||
For the above reason, the Work is provided under the Licence on an ‘as is’
|
||||
basis and without warranties of any kind concerning the Work, including
|
||||
without limitation merchantability, fitness for a particular purpose, absence
|
||||
of defects or errors, accuracy, non-infringement of intellectual property
|
||||
rights other than copyright as stated in Article 6 of this Licence.
|
||||
|
||||
This disclaimer of warranty is an essential part of the Licence and a
|
||||
condition for the grant of any rights to the Work.
|
||||
|
||||
8. Disclaimer of Liability
|
||||
|
||||
Except in the cases of wilful misconduct or damages directly caused to natural
|
||||
persons, the Licensor will in no event be liable for any direct or indirect,
|
||||
material or moral, damages of any kind, arising out of the Licence or of the
|
||||
use of the Work, including without limitation, damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, loss of data or any commercial
|
||||
damage, even if the Licensor has been advised of the possibility of such
|
||||
damage. However, the Licensor will be liable under statutory product liability
|
||||
laws as far such laws apply to the Work.
|
||||
|
||||
9. Additional agreements
|
||||
|
||||
While distributing the Work, You may choose to conclude an additional
|
||||
agreement, defining obligations or services consistent with this Licence.
|
||||
However, if accepting obligations, You may act only on your own behalf and on
|
||||
your sole responsibility, not on behalf of the original Licensor or any other
|
||||
Contributor, and only if You agree to indemnify, defend, and hold each
|
||||
Contributor harmless for any liability incurred by, or claims asserted against
|
||||
such Contributor by the fact You have accepted any warranty or additional
|
||||
liability.
|
||||
|
||||
10. Acceptance of the Licence
|
||||
|
||||
The provisions of this Licence can be accepted by clicking on an icon ‘I
|
||||
agree’ placed under the bottom of a window displaying the text of this Licence
|
||||
or by affirming consent in any other similar way, in accordance with the rules
|
||||
of applicable law. Clicking on that icon indicates your clear and irrevocable
|
||||
acceptance of this Licence and all of its terms and conditions.
|
||||
|
||||
Similarly, you irrevocably accept this Licence and all of its terms and
|
||||
conditions by exercising any rights granted to You by Article 2 of this
|
||||
Licence, such as the use of the Work, the creation by You of a Derivative Work
|
||||
or the Distribution or Communication by You of the Work or copies thereof.
|
||||
|
||||
11. Information to the public
|
||||
|
||||
In case of any Distribution or Communication of the Work by means of
|
||||
electronic communication by You (for example, by offering to download the Work
|
||||
from a remote location) the distribution channel or media (for example, a
|
||||
website) must at least provide to the public the information requested by the
|
||||
applicable law regarding the Licensor, the Licence and the way it may be
|
||||
accessible, concluded, stored and reproduced by the Licensee.
|
||||
|
||||
12. Termination of the Licence
|
||||
|
||||
The Licence and the rights granted hereunder will terminate automatically upon
|
||||
any breach by the Licensee of the terms of the Licence.
|
||||
|
||||
Such a termination will not terminate the licences of any person who has
|
||||
received the Work from the Licensee under the Licence, provided such persons
|
||||
remain in full compliance with the Licence.
|
||||
|
||||
13. Miscellaneous
|
||||
|
||||
Without prejudice of Article 9 above, the Licence represents the complete
|
||||
agreement between the Parties as to the Work.
|
||||
|
||||
If any provision of the Licence is invalid or unenforceable under applicable
|
||||
law, this will not affect the validity or enforceability of the Licence as a
|
||||
whole. Such provision will be construed or reformed so as necessary to make it
|
||||
valid and enforceable.
|
||||
|
||||
The European Commission may publish other linguistic versions or new versions
|
||||
of this Licence or updated versions of the Appendix, so far this is required
|
||||
and reasonable, without reducing the scope of the rights granted by the
|
||||
Licence. New versions of the Licence will be published with a unique version
|
||||
number.
|
||||
|
||||
All linguistic versions of this Licence, approved by the European Commission,
|
||||
have identical value. Parties can take advantage of the linguistic version of
|
||||
their choice.
|
||||
|
||||
14. Jurisdiction
|
||||
|
||||
Without prejudice to specific agreement between parties,
|
||||
|
||||
- any litigation resulting from the interpretation of this License, arising
|
||||
between the European Union institutions, bodies, offices or agencies, as a
|
||||
Licensor, and any Licensee, will be subject to the jurisdiction of the Court
|
||||
of Justice of the European Union, as laid down in article 272 of the Treaty
|
||||
on the Functioning of the European Union,
|
||||
|
||||
- any litigation arising between other parties and resulting from the
|
||||
interpretation of this License, will be subject to the exclusive
|
||||
jurisdiction of the competent court where the Licensor resides or conducts
|
||||
its primary business.
|
||||
|
||||
15. Applicable Law
|
||||
|
||||
Without prejudice to specific agreement between parties,
|
||||
|
||||
- this Licence shall be governed by the law of the European Union Member State
|
||||
where the Licensor has his seat, resides or has his registered office,
|
||||
|
||||
- this licence shall be governed by Belgian law if the Licensor has no seat,
|
||||
residence or registered office inside a European Union Member State.
|
||||
|
||||
Appendix
|
||||
|
||||
‘Compatible Licences’ according to Article 5 EUPL are:
|
||||
|
||||
- GNU General Public License (GPL) v. 2, v. 3
|
||||
- GNU Affero General Public License (AGPL) v. 3
|
||||
- Open Software License (OSL) v. 2.1, v. 3.0
|
||||
- Eclipse Public License (EPL) v. 1.0
|
||||
- CeCILL v. 2.0, v. 2.1
|
||||
- Mozilla Public Licence (MPL) v. 2
|
||||
- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
||||
- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
|
||||
works other than software
|
||||
- European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
||||
- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
|
||||
Reciprocity (LiLiQ-R+).
|
||||
|
||||
The European Commission may update this Appendix to later versions of the
|
||||
above licences without producing a new version of the EUPL, as long as they
|
||||
provide the rights granted in Article 2 of this Licence and protect the
|
||||
covered Source Code from exclusive appropriation.
|
||||
|
||||
All other changes or additions to this Appendix require the production of a
|
||||
new EUPL version.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://ui.shadcn.com/schema.json",
|
||||
"style": "new-york",
|
||||
"rsc": true,
|
||||
"tsx": true,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "src/app/globals.css",
|
||||
"baseColor": "neutral",
|
||||
"cssVariables": true,
|
||||
"prefix": ""
|
||||
},
|
||||
"iconLibrary": "lucide",
|
||||
"rtl": false,
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils",
|
||||
"ui": "@/components/ui",
|
||||
"lib": "@/lib",
|
||||
"hooks": "@/hooks"
|
||||
},
|
||||
"registries": {}
|
||||
}
|
||||
@@ -9,9 +9,15 @@
|
||||
"lint": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.564.0",
|
||||
"next": "16.1.6",
|
||||
"radix-ui": "^1.4.3",
|
||||
"react": "19.2.3",
|
||||
"react-dom": "19.2.3"
|
||||
"react-dom": "19.2.3",
|
||||
"recharts": "^3.7.0",
|
||||
"tailwind-merge": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
@@ -20,7 +26,9 @@
|
||||
"@types/react-dom": "^19",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.1.6",
|
||||
"shadcn": "^3.8.4",
|
||||
"tailwindcss": "^4",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 64 KiB |
@@ -1,26 +1,128 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
@import "shadcn/tailwind.css";
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
}
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--radius-2xl: calc(var(--radius) + 8px);
|
||||
--radius-3xl: calc(var(--radius) + 12px);
|
||||
--radius-4xl: calc(var(--radius) + 16px);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
:root {
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,28 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import { IBM_Plex_Sans, IBM_Plex_Sans_Condensed, IBM_Plex_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
const ibmPlexSans = IBM_Plex_Sans({
|
||||
variable: "--font-ibm-plex-sans",
|
||||
subsets: ["latin"],
|
||||
weight: ["300", "400", "500", "600", "700"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
const ibmPlexSansCondensed = IBM_Plex_Sans_Condensed({
|
||||
variable: "--font-ibm-plex-sans-condensed",
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "500", "600", "700"],
|
||||
});
|
||||
|
||||
const ibmPlexMono = IBM_Plex_Mono({
|
||||
variable: "--font-ibm-plex-mono",
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "500", "600"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: "Ruimtemodel Stadslogistiek",
|
||||
description: "Cockpit voor het berekenen van de benodigde ruimte voor logistieke activiteiten",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
@@ -23,9 +31,10 @@ export default function RootLayout({
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<html lang="nl">
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
className={`${ibmPlexSans.variable} ${ibmPlexSansCondensed.variable} ${ibmPlexMono.variable} antialiased`}
|
||||
style={{ fontFamily: 'var(--font-ibm-plex-sans), sans-serif' }}
|
||||
>
|
||||
{children}
|
||||
</body>
|
||||
|
||||
@@ -1,65 +1,20 @@
|
||||
import Image from "next/image";
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useSimulationState, type LayoutType } from '@/lib/use-simulation-state';
|
||||
import DmiCockpitLayout from '@/components/layouts/DmiCockpitLayout';
|
||||
import RebelExcelLayout from '@/components/layouts/RebelExcelLayout';
|
||||
import WebappLayout from '@/components/layouts/WebappLayout';
|
||||
|
||||
export default function Home() {
|
||||
const [layout, setLayout] = useState<LayoutType>('dmi');
|
||||
const state = useSimulationState();
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<>
|
||||
{layout === 'rebel' && <RebelExcelLayout state={state} layout={layout} onLayoutChange={setLayout} />}
|
||||
{layout === 'dmi' && <DmiCockpitLayout state={state} layout={layout} onLayoutChange={setLayout} />}
|
||||
{layout === 'webapp' && <WebappLayout state={state} layout={layout} onLayoutChange={setLayout} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useRef, useCallback, useEffect } from 'react';
|
||||
import type { LayoutType } from '@/lib/use-simulation-state';
|
||||
import { DMI } from '@/lib/dmi-theme';
|
||||
|
||||
const LAYOUTS: { id: LayoutType; label: string; description: string }[] = [
|
||||
{ id: 'rebel', label: 'Excel (Rebel)', description: 'Originele Excel layout' },
|
||||
{ id: 'dmi', label: 'Cockpit (DMI)', description: 'DMI-gestylede cockpit' },
|
||||
{ id: 'webapp', label: 'Webapp', description: 'Geoptimaliseerde webapp' },
|
||||
];
|
||||
|
||||
export default function LayoutSwitcher({
|
||||
current,
|
||||
onChange,
|
||||
}: {
|
||||
current: LayoutType;
|
||||
onChange: (layout: LayoutType) => void;
|
||||
}) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const [position, setPosition] = useState({ x: 12, y: 12 });
|
||||
const [dragging, setDragging] = useState(false);
|
||||
const dragOffset = useRef({ x: 0, y: 0 });
|
||||
const didDrag = useRef(false);
|
||||
|
||||
const onPointerDown = useCallback((e: React.PointerEvent) => {
|
||||
// Only drag from the grip handle area
|
||||
const target = e.target as HTMLElement;
|
||||
if (target.tagName === 'BUTTON') return;
|
||||
e.preventDefault();
|
||||
setDragging(true);
|
||||
didDrag.current = false;
|
||||
const rect = containerRef.current!.getBoundingClientRect();
|
||||
dragOffset.current = { x: e.clientX - rect.left, y: e.clientY - rect.top };
|
||||
(e.target as HTMLElement).setPointerCapture(e.pointerId);
|
||||
}, []);
|
||||
|
||||
const onPointerMove = useCallback(
|
||||
(e: React.PointerEvent) => {
|
||||
if (!dragging) return;
|
||||
didDrag.current = true;
|
||||
const newX = e.clientX - dragOffset.current.x;
|
||||
const newY = e.clientY - dragOffset.current.y;
|
||||
setPosition({ x: newX, y: newY });
|
||||
},
|
||||
[dragging],
|
||||
);
|
||||
|
||||
const onPointerUp = useCallback(() => {
|
||||
setDragging(false);
|
||||
}, []);
|
||||
|
||||
// Initialize position to top-right
|
||||
useEffect(() => {
|
||||
setPosition({ x: window.innerWidth - 280, y: 12 });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
onPointerDown={onPointerDown}
|
||||
onPointerMove={onPointerMove}
|
||||
onPointerUp={onPointerUp}
|
||||
style={{
|
||||
position: 'fixed',
|
||||
left: position.x,
|
||||
top: position.y,
|
||||
zIndex: 9999,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '2px',
|
||||
backgroundColor: 'rgba(10, 54, 96, 0.95)',
|
||||
borderRadius: '8px',
|
||||
padding: '3px',
|
||||
boxShadow: dragging
|
||||
? '0 8px 24px rgba(0,0,0,0.4)'
|
||||
: '0 4px 12px rgba(0,0,0,0.3)',
|
||||
backdropFilter: 'blur(8px)',
|
||||
cursor: dragging ? 'grabbing' : 'grab',
|
||||
userSelect: 'none',
|
||||
touchAction: 'none',
|
||||
transition: dragging ? 'none' : 'box-shadow 0.2s ease',
|
||||
}}
|
||||
>
|
||||
{/* Drag grip */}
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '2px',
|
||||
padding: '0 6px 0 4px',
|
||||
cursor: dragging ? 'grabbing' : 'grab',
|
||||
}}
|
||||
title="Drag to move"
|
||||
>
|
||||
<div style={{ display: 'flex', gap: '2px' }}>
|
||||
<div style={{ width: 3, height: 3, borderRadius: '50%', backgroundColor: '#ffffff66' }} />
|
||||
<div style={{ width: 3, height: 3, borderRadius: '50%', backgroundColor: '#ffffff66' }} />
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '2px' }}>
|
||||
<div style={{ width: 3, height: 3, borderRadius: '50%', backgroundColor: '#ffffff66' }} />
|
||||
<div style={{ width: 3, height: 3, borderRadius: '50%', backgroundColor: '#ffffff66' }} />
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '2px' }}>
|
||||
<div style={{ width: 3, height: 3, borderRadius: '50%', backgroundColor: '#ffffff66' }} />
|
||||
<div style={{ width: 3, height: 3, borderRadius: '50%', backgroundColor: '#ffffff66' }} />
|
||||
</div>
|
||||
</div>
|
||||
{LAYOUTS.map((layout) => (
|
||||
<button
|
||||
key={layout.id}
|
||||
onClick={() => onChange(layout.id)}
|
||||
title={layout.description}
|
||||
style={{
|
||||
padding: '6px 14px',
|
||||
borderRadius: '6px',
|
||||
border: 'none',
|
||||
cursor: 'pointer',
|
||||
fontSize: '0.75rem',
|
||||
fontFamily: 'var(--font-ibm-plex-sans-condensed), sans-serif',
|
||||
fontWeight: current === layout.id ? 700 : 500,
|
||||
backgroundColor: current === layout.id ? DMI.yellow : 'transparent',
|
||||
color: current === layout.id ? DMI.darkBlue : '#ffffffcc',
|
||||
transition: 'all 0.2s ease',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
{layout.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import * as React from "react"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const alertVariants = cva(
|
||||
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-card text-card-foreground",
|
||||
destructive:
|
||||
"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
function Alert({
|
||||
className,
|
||||
variant,
|
||||
...props
|
||||
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="alert"
|
||||
role="alert"
|
||||
className={cn(alertVariants({ variant }), className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="alert-title"
|
||||
className={cn(
|
||||
"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDescription({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="alert-description"
|
||||
className={cn(
|
||||
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Alert, AlertTitle, AlertDescription }
|
||||
@@ -0,0 +1,48 @@
|
||||
import * as React from "react"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { Slot } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const badgeVariants = cva(
|
||||
"inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
||||
destructive:
|
||||
"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||
outline:
|
||||
"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
||||
ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
||||
link: "text-primary underline-offset-4 [a&]:hover:underline",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
function Badge({
|
||||
className,
|
||||
variant = "default",
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"span"> &
|
||||
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
||||
const Comp = asChild ? Slot.Root : "span"
|
||||
|
||||
return (
|
||||
<Comp
|
||||
data-slot="badge"
|
||||
data-variant={variant}
|
||||
className={cn(badgeVariants({ variant }), className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Badge, badgeVariants }
|
||||
@@ -0,0 +1,64 @@
|
||||
import * as React from "react"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { Slot } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
||||
destructive:
|
||||
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||
outline:
|
||||
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||
ghost:
|
||||
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
||||
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
icon: "size-9",
|
||||
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
||||
"icon-sm": "size-8",
|
||||
"icon-lg": "size-10",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
function Button({
|
||||
className,
|
||||
variant = "default",
|
||||
size = "default",
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"button"> &
|
||||
VariantProps<typeof buttonVariants> & {
|
||||
asChild?: boolean
|
||||
}) {
|
||||
const Comp = asChild ? Slot.Root : "button"
|
||||
|
||||
return (
|
||||
<Comp
|
||||
data-slot="button"
|
||||
data-variant={variant}
|
||||
data-size={size}
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Button, buttonVariants }
|
||||
@@ -0,0 +1,92 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card"
|
||||
className={cn(
|
||||
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-header"
|
||||
className={cn(
|
||||
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-title"
|
||||
className={cn("leading-none font-semibold", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-description"
|
||||
className={cn("text-muted-foreground text-sm", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-action"
|
||||
className={cn(
|
||||
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-content"
|
||||
className={cn("px-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-footer"
|
||||
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Card,
|
||||
CardHeader,
|
||||
CardFooter,
|
||||
CardTitle,
|
||||
CardAction,
|
||||
CardDescription,
|
||||
CardContent,
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Input }
|
||||
@@ -0,0 +1,24 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { Label as LabelPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Label({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
return (
|
||||
<LabelPrimitive.Root
|
||||
data-slot="label"
|
||||
className={cn(
|
||||
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Label }
|
||||
@@ -0,0 +1,190 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
|
||||
import { Select as SelectPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Select({
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
||||
return <SelectPrimitive.Root data-slot="select" {...props} />
|
||||
}
|
||||
|
||||
function SelectGroup({
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
||||
return <SelectPrimitive.Group data-slot="select-group" {...props} />
|
||||
}
|
||||
|
||||
function SelectValue({
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
||||
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
||||
}
|
||||
|
||||
function SelectTrigger({
|
||||
className,
|
||||
size = "default",
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
||||
size?: "sm" | "default"
|
||||
}) {
|
||||
return (
|
||||
<SelectPrimitive.Trigger
|
||||
data-slot="select-trigger"
|
||||
data-size={size}
|
||||
className={cn(
|
||||
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<SelectPrimitive.Icon asChild>
|
||||
<ChevronDownIcon className="size-4 opacity-50" />
|
||||
</SelectPrimitive.Icon>
|
||||
</SelectPrimitive.Trigger>
|
||||
)
|
||||
}
|
||||
|
||||
function SelectContent({
|
||||
className,
|
||||
children,
|
||||
position = "item-aligned",
|
||||
align = "center",
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
||||
return (
|
||||
<SelectPrimitive.Portal>
|
||||
<SelectPrimitive.Content
|
||||
data-slot="select-content"
|
||||
className={cn(
|
||||
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
||||
position === "popper" &&
|
||||
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
||||
className
|
||||
)}
|
||||
position={position}
|
||||
align={align}
|
||||
{...props}
|
||||
>
|
||||
<SelectScrollUpButton />
|
||||
<SelectPrimitive.Viewport
|
||||
className={cn(
|
||||
"p-1",
|
||||
position === "popper" &&
|
||||
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</SelectPrimitive.Viewport>
|
||||
<SelectScrollDownButton />
|
||||
</SelectPrimitive.Content>
|
||||
</SelectPrimitive.Portal>
|
||||
)
|
||||
}
|
||||
|
||||
function SelectLabel({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
||||
return (
|
||||
<SelectPrimitive.Label
|
||||
data-slot="select-label"
|
||||
className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function SelectItem({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
||||
return (
|
||||
<SelectPrimitive.Item
|
||||
data-slot="select-item"
|
||||
className={cn(
|
||||
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<span
|
||||
data-slot="select-item-indicator"
|
||||
className="absolute right-2 flex size-3.5 items-center justify-center"
|
||||
>
|
||||
<SelectPrimitive.ItemIndicator>
|
||||
<CheckIcon className="size-4" />
|
||||
</SelectPrimitive.ItemIndicator>
|
||||
</span>
|
||||
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
||||
</SelectPrimitive.Item>
|
||||
)
|
||||
}
|
||||
|
||||
function SelectSeparator({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
||||
return (
|
||||
<SelectPrimitive.Separator
|
||||
data-slot="select-separator"
|
||||
className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function SelectScrollUpButton({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
||||
return (
|
||||
<SelectPrimitive.ScrollUpButton
|
||||
data-slot="select-scroll-up-button"
|
||||
className={cn(
|
||||
"flex cursor-default items-center justify-center py-1",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronUpIcon className="size-4" />
|
||||
</SelectPrimitive.ScrollUpButton>
|
||||
)
|
||||
}
|
||||
|
||||
function SelectScrollDownButton({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
||||
return (
|
||||
<SelectPrimitive.ScrollDownButton
|
||||
data-slot="select-scroll-down-button"
|
||||
className={cn(
|
||||
"flex cursor-default items-center justify-center py-1",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronDownIcon className="size-4" />
|
||||
</SelectPrimitive.ScrollDownButton>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectLabel,
|
||||
SelectScrollDownButton,
|
||||
SelectScrollUpButton,
|
||||
SelectSeparator,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { Separator as SeparatorPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Separator({
|
||||
className,
|
||||
orientation = "horizontal",
|
||||
decorative = true,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
||||
return (
|
||||
<SeparatorPrimitive.Root
|
||||
data-slot="separator"
|
||||
decorative={decorative}
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Separator }
|
||||
@@ -0,0 +1,63 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { Slider as SliderPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Slider({
|
||||
className,
|
||||
defaultValue,
|
||||
value,
|
||||
min = 0,
|
||||
max = 100,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
|
||||
const _values = React.useMemo(
|
||||
() =>
|
||||
Array.isArray(value)
|
||||
? value
|
||||
: Array.isArray(defaultValue)
|
||||
? defaultValue
|
||||
: [min, max],
|
||||
[value, defaultValue, min, max]
|
||||
)
|
||||
|
||||
return (
|
||||
<SliderPrimitive.Root
|
||||
data-slot="slider"
|
||||
defaultValue={defaultValue}
|
||||
value={value}
|
||||
min={min}
|
||||
max={max}
|
||||
className={cn(
|
||||
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<SliderPrimitive.Track
|
||||
data-slot="slider-track"
|
||||
className={cn(
|
||||
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
||||
)}
|
||||
>
|
||||
<SliderPrimitive.Range
|
||||
data-slot="slider-range"
|
||||
className={cn(
|
||||
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
||||
)}
|
||||
/>
|
||||
</SliderPrimitive.Track>
|
||||
{Array.from({ length: _values.length }, (_, index) => (
|
||||
<SliderPrimitive.Thumb
|
||||
data-slot="slider-thumb"
|
||||
key={index}
|
||||
className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
||||
/>
|
||||
))}
|
||||
</SliderPrimitive.Root>
|
||||
)
|
||||
}
|
||||
|
||||
export { Slider }
|
||||
@@ -0,0 +1,116 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="table-container"
|
||||
className="relative w-full overflow-x-auto"
|
||||
>
|
||||
<table
|
||||
data-slot="table"
|
||||
className={cn("w-full caption-bottom text-sm", className)}
|
||||
{...props}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
||||
return (
|
||||
<thead
|
||||
data-slot="table-header"
|
||||
className={cn("[&_tr]:border-b", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
|
||||
return (
|
||||
<tbody
|
||||
data-slot="table-body"
|
||||
className={cn("[&_tr:last-child]:border-0", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
||||
return (
|
||||
<tfoot
|
||||
data-slot="table-footer"
|
||||
className={cn(
|
||||
"bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
||||
return (
|
||||
<tr
|
||||
data-slot="table-row"
|
||||
className={cn(
|
||||
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
||||
return (
|
||||
<th
|
||||
data-slot="table-head"
|
||||
className={cn(
|
||||
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
||||
return (
|
||||
<td
|
||||
data-slot="table-cell"
|
||||
className={cn(
|
||||
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableCaption({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"caption">) {
|
||||
return (
|
||||
<caption
|
||||
data-slot="table-caption"
|
||||
className={cn("text-muted-foreground mt-4 text-sm", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Table,
|
||||
TableHeader,
|
||||
TableBody,
|
||||
TableFooter,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TableCell,
|
||||
TableCaption,
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { Tabs as TabsPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Tabs({
|
||||
className,
|
||||
orientation = "horizontal",
|
||||
...props
|
||||
}: React.ComponentProps<typeof TabsPrimitive.Root>) {
|
||||
return (
|
||||
<TabsPrimitive.Root
|
||||
data-slot="tabs"
|
||||
data-orientation={orientation}
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const tabsListVariants = cva(
|
||||
"rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-muted",
|
||||
line: "gap-1 bg-transparent",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
function TabsList({
|
||||
className,
|
||||
variant = "default",
|
||||
...props
|
||||
}: React.ComponentProps<typeof TabsPrimitive.List> &
|
||||
VariantProps<typeof tabsListVariants>) {
|
||||
return (
|
||||
<TabsPrimitive.List
|
||||
data-slot="tabs-list"
|
||||
data-variant={variant}
|
||||
className={cn(tabsListVariants({ variant }), className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TabsTrigger({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
|
||||
return (
|
||||
<TabsPrimitive.Trigger
|
||||
data-slot="tabs-trigger"
|
||||
className={cn(
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent",
|
||||
"data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground",
|
||||
"after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TabsContent({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
||||
return (
|
||||
<TabsPrimitive.Content
|
||||
data-slot="tabs-content"
|
||||
className={cn("flex-1 outline-none", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
|
||||
@@ -0,0 +1,57 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function TooltipProvider({
|
||||
delayDuration = 0,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
||||
return (
|
||||
<TooltipPrimitive.Provider
|
||||
data-slot="tooltip-provider"
|
||||
delayDuration={delayDuration}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function Tooltip({
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
||||
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
||||
}
|
||||
|
||||
function TooltipTrigger({
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
||||
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
||||
}
|
||||
|
||||
function TooltipContent({
|
||||
className,
|
||||
sideOffset = 0,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
||||
return (
|
||||
<TooltipPrimitive.Portal>
|
||||
<TooltipPrimitive.Content
|
||||
data-slot="tooltip-content"
|
||||
sideOffset={sideOffset}
|
||||
className={cn(
|
||||
"bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
||||
</TooltipPrimitive.Content>
|
||||
</TooltipPrimitive.Portal>
|
||||
)
|
||||
}
|
||||
|
||||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
||||
@@ -0,0 +1,89 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Shared content for Cover page and Handleiding across all 3 layouts
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface PartnerLogo {
|
||||
src: string;
|
||||
alt: string;
|
||||
organization: string;
|
||||
}
|
||||
|
||||
export interface HandleidingSection {
|
||||
title: string;
|
||||
paragraphs: string[];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Partner logos
|
||||
// ---------------------------------------------------------------------------
|
||||
export const PARTNER_LOGOS: PartnerLogo[] = [
|
||||
{ src: '/logos/DMI-ECOSYSTEEM-LOGO-RGB-72dpi.png', alt: 'DMI Ecosysteem', organization: 'DMI Ecosysteem' },
|
||||
{ src: '/logos/Amsterdam-logo.png', alt: 'Gemeente Amsterdam', organization: 'Gemeente Amsterdam' },
|
||||
{ src: '/logos/utrecht-logo.jpg', alt: 'Gemeente Utrecht', organization: 'Gemeente Utrecht' },
|
||||
{ src: '/logos/HvA-logo.png', alt: 'Hogeschool van Amsterdam', organization: 'Hogeschool van Amsterdam' },
|
||||
{ src: '/logos/HAN-logo.png', alt: 'HAN University of Applied Sciences', organization: 'HAN University of Applied Sciences' },
|
||||
{ src: '/logos/BUAS-logo.jpg', alt: 'Breda University of Applied Sciences', organization: 'Breda University of Applied Sciences' },
|
||||
{ src: '/logos/Rebel_logo.png', alt: 'Rebel Group', organization: 'Rebel Group' },
|
||||
{ src: '/logos/Posad_logo.png', alt: 'Posad Maxwan', organization: 'Posad Maxwan' },
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Cover page data
|
||||
// ---------------------------------------------------------------------------
|
||||
export const COVER = {
|
||||
title: 'Ruimtemodel Stadslogistiek',
|
||||
subtitle: 'Monte Carlo-simulatie voor het dimensioneren van laad- en losruimte',
|
||||
description:
|
||||
'Het Ruimtemodel Stadslogistiek is ontwikkeld om gemeenten, gebiedsontwikkelaars en logistieke planners te ondersteunen bij het bepalen van de benodigde ruimte voor stedelijke logistiek. Het model maakt gebruik van Monte Carlo-simulatie om stochastische voertuigaankomsten te modelleren en op basis daarvan de piekbelasting te berekenen.',
|
||||
projectLabel: 'Een samenwerking van:',
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Handleiding sections
|
||||
// ---------------------------------------------------------------------------
|
||||
export const HANDLEIDING_SECTIONS: HandleidingSection[] = [
|
||||
{
|
||||
title: '1. Algemeen',
|
||||
paragraphs: [
|
||||
'Het Ruimtemodel Stadslogistiek is een simulatietool dat de benodigde laad- en losruimte berekent voor stedelijke gebiedsontwikkelingen. Het model werkt op basis van Monte Carlo-simulatie: het genereert duizenden willekeurige scenario\'s van voertuigaankomsten en bepaalt daaruit de piekbelasting.',
|
||||
'Het model combineert drie kernconcepten: functies (het type en aantal voorzieningen in een gebied), voertuigtypen (de verschillende soorten voertuigen die goederen leveren) en verdelingen (de statistische patronen van aankomsten per tijdvak).',
|
||||
'De uitkomst is de benodigde lengte (in meters) laad- en losruimte die nodig is om een bepaald service level te garanderen \u2014 bijvoorbeeld dat 95% van de tijd voldoende ruimte beschikbaar is.',
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '2. Input voor het model',
|
||||
paragraphs: [
|
||||
'De invoer bestaat uit het aantal eenheden per functie in het plangebied. Functies zijn onder andere: Woningen, Supermarkt, Overige food, Non-food winkels, Horeca, Kantoren, Leisure/Sport, Onderwijs, en Gezondheidszorg. Elke functie wordt uitgedrukt in een specifieke eenheid (bijv. aantal woningen, m\u00B2 BVO).',
|
||||
'De BVO-conversietabel vertaalt bruto vloeroppervlakte (m\u00B2) naar het equivalent aantal eenheden dat het model gebruikt voor de berekening van voertuigbewegingen.',
|
||||
'Voertuigtypen worden ingedeeld in clusters die dezelfde fysieke laad-/losruimte delen. Per cluster wordt een service level ingesteld dat bepaalt welk percentage van de tijd de beschikbare ruimte toereikend moet zijn.',
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '3. Overzicht functies',
|
||||
paragraphs: [
|
||||
'Elke functie in het model vertegenwoordigt een categorie stedelijke voorzieningen. De functies zijn gekoppeld aan SBI-codes (Standaard Bedrijfsindeling) en genereren elk een kenmerkend patroon van voertuigbewegingen.',
|
||||
'Woningen genereren pakketbezorgingen en verhuizingen. Supermarkten hebben frequente leveringen van verse producten. Kantoren ontvangen post, pakketten en facilitaire leveringen. Horeca heeft dagelijkse leveringen van dranken en voedsel.',
|
||||
'Het model houdt rekening met het gemiddeld aantal stops per eenheid per week, de verdeling over voertuigtypen, en het tijdspatroon van aankomsten gedurende de dag.',
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '4. Resultaten',
|
||||
paragraphs: [
|
||||
'De resultaten tonen de benodigde laad- en losruimte per cluster en per voertuigtype. De belangrijkste KPI is de totale benodigde lengte in meters, berekend op het gekozen service level.',
|
||||
'Per cluster wordt weergegeven: het aantal verwachte voertuigen per dag, het maximaal gelijktijdig aanwezige aantal voertuigen (bij het gekozen service level), en de daaruit volgende benodigde ruimte.',
|
||||
'De service level-curve toont het verband tussen het gekozen service level en de benodigde ruimte. Een hoger service level resulteert in meer benodigde ruimte, maar biedt meer zekerheid dat er voldoende plek is tijdens piekuren.',
|
||||
'Het piekprofiel per tijdvak laat zien in welk deel van de dag de meeste laad-/losruimte nodig is, zodat beleidsmakers gericht maatregelen kunnen nemen.',
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '5. Werking Ruimtemodel',
|
||||
paragraphs: [
|
||||
'Het model doorloopt vijf stappen om de benodigde ruimte te berekenen:',
|
||||
'Stap 1 \u2014 Berekenen stops per functie: Op basis van het aantal eenheden per functie en de gemiddelde stops per eenheid per week wordt het totale aantal voertuigstops berekend.',
|
||||
'Stap 2 \u2014 Kansverdeling per voertuigtype: De voertuigstops worden verdeeld over de verschillende voertuigtypen (pakketdiensten, vrachtwagens, bestelbussen, etc.) op basis van empirische kansverdelingen.',
|
||||
'Stap 3 \u2014 Simulatie van aankomsten: Met Monte Carlo-simulatie worden duizenden scenario\'s gegenereerd waarin voertuigen op willekeurige momenten aankomen, rekening houdend met het tijdsprofiel per dagdeel.',
|
||||
'Stap 4 \u2014 Bepaling clusters en service levels: Per cluster wordt bepaald hoeveel voertuigen maximaal gelijktijdig aanwezig zijn bij het gekozen service level. Dit bepaalt het aantal benodigde laad-/losplekken.',
|
||||
'Stap 5 \u2014 Resultaten: De benodigde lengte per voertuigtype wordt opgeteld per cluster en over alle clusters heen tot het totale ruimtebeslag. De resultaten worden gepresenteerd in grafieken en tabellen.',
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,70 @@
|
||||
export const DMI = {
|
||||
darkBlue: '#0a3660',
|
||||
yellow: '#ffba08',
|
||||
mediumBlue: '#115491',
|
||||
blueTint1: '#a3cdf4',
|
||||
blueTint2: '#daebfb',
|
||||
blueTint3: '#f6f9fd',
|
||||
darkGray: '#565656',
|
||||
lightGray: '#efefef',
|
||||
white: '#ffffff',
|
||||
themeLogistics: '#ffd493',
|
||||
themeAreaDev: '#9ce4a3',
|
||||
themeMobility: '#b3edeb',
|
||||
themeDigitalTwins: '#dfbdf9',
|
||||
} as const;
|
||||
|
||||
export const PERIOD_COLORS = [DMI.blueTint1, DMI.mediumBlue, DMI.yellow, DMI.themeLogistics];
|
||||
|
||||
export const FUNCTION_COLORS = [
|
||||
'#0a3660', '#115491', '#a3cdf4', '#ffba08',
|
||||
'#ffd493', '#9ce4a3', '#b3edeb', '#dfbdf9',
|
||||
'#3b82f6', '#8b5cf6', '#ef4444', '#f59e0b',
|
||||
];
|
||||
|
||||
export const CLUSTER_COLORS: Record<number, string> = {
|
||||
1: DMI.mediumBlue,
|
||||
2: DMI.yellow,
|
||||
3: DMI.themeAreaDev,
|
||||
4: DMI.themeMobility,
|
||||
5: DMI.themeDigitalTwins,
|
||||
6: DMI.themeLogistics,
|
||||
7: DMI.blueTint1,
|
||||
};
|
||||
|
||||
export const CLUSTER_NAMES: Record<number, string> = {
|
||||
1: 'Licht vervoer',
|
||||
2: 'Zwaar vervoer',
|
||||
3: 'Service voertuigen',
|
||||
};
|
||||
|
||||
export const SERVICE_LEVEL_OPTIONS = [
|
||||
{ value: '0.75', label: '75%' },
|
||||
{ value: '0.80', label: '80%' },
|
||||
{ value: '0.85', label: '85%' },
|
||||
{ value: '0.90', label: '90%' },
|
||||
{ value: '0.95', label: '95%' },
|
||||
];
|
||||
|
||||
export const MAX_CLUSTERS = 7;
|
||||
|
||||
export const heading: React.CSSProperties = {
|
||||
fontFamily: 'var(--font-ibm-plex-sans-condensed), sans-serif',
|
||||
fontWeight: 700,
|
||||
color: DMI.darkBlue,
|
||||
};
|
||||
|
||||
export const bodyText: React.CSSProperties = {
|
||||
fontFamily: 'var(--font-ibm-plex-sans), sans-serif',
|
||||
fontWeight: 400,
|
||||
color: DMI.darkGray,
|
||||
};
|
||||
|
||||
export const labelMono: React.CSSProperties = {
|
||||
fontFamily: 'var(--font-ibm-plex-mono), monospace',
|
||||
textTransform: 'uppercase' as const,
|
||||
fontSize: '0.65rem',
|
||||
letterSpacing: '0.05em',
|
||||
color: DMI.mediumBlue,
|
||||
fontWeight: 500,
|
||||
};
|
||||
@@ -0,0 +1,481 @@
|
||||
// Vehicle types
|
||||
export const VEHICLES = [
|
||||
{ id: 'V1', name: 'Fiets, cargobike, scooter', length: 2 },
|
||||
{ id: 'V2', name: 'LEVV / personenwagen', length: 6 },
|
||||
{ id: 'V3', name: 'Bestelwagen <3,5 ton (N1)', length: 8 },
|
||||
{ id: 'V4', name: 'Vrachtwagen (N2)', length: 11 },
|
||||
{ id: 'V5', name: 'Grote vrachtwagen (N3)', length: 16 },
|
||||
{ id: 'V6', name: 'Service bestelwagen', length: 8 },
|
||||
] as const;
|
||||
|
||||
// Function types (building/land uses)
|
||||
export const FUNCTIONS = [
|
||||
{ id: 'F1', name: 'Woningen', unit: 'woningen', description: 'Consumenten die samen een woning en huishouding delen en die als 1 afleveradres worden geteld.' },
|
||||
{ id: 'F2', name: 'Supermarkt', unit: 'vestigingen', description: 'Standaard supermarkt zonder laad- en losruimte op eigen terrein.' },
|
||||
{ id: 'F3', name: 'Retail Food', unit: 'vestigingen', description: 'Winkels zoals bakkerijen, viswinkels, kaaswinkels, natuurvoeding.' },
|
||||
{ id: 'F4', name: 'Retail Winkels (Keten)', unit: 'vestigingen', description: 'Retail keten voor mode, huishoudelijke artikelen, electronica.' },
|
||||
{ id: 'F5', name: 'Retail Winkels (Onafh.)', unit: 'vestigingen', description: 'Onafhankelijke boekenwinkel, electronicazaak, etc.' },
|
||||
{ id: 'F6', name: 'Restaurant (High-end)', unit: 'vestigingen', description: 'Gastronomisch restaurant (high en middle class).' },
|
||||
{ id: 'F7', name: 'Restaurant (Basis)', unit: 'vestigingen', description: 'Basis restaurant.' },
|
||||
{ id: 'F8', name: 'Caf\u00e9', unit: 'vestigingen', description: 'Caf\u00e9.' },
|
||||
{ id: 'F9', name: 'Hotel', unit: 'vestigingen', description: 'Hotel (met of zonder restaurant).' },
|
||||
{ id: 'F10', name: 'Kantoor (Klein)', unit: 'vestigingen', description: 'Kantoren tot 2500 m\u00b2 BVO.' },
|
||||
{ id: 'F11', name: 'Kantoor (Middel)', unit: 'vestigingen', description: 'Kantoren tussen 2500 m\u00b2 en 10.000 m\u00b2 BVO.' },
|
||||
{ id: 'F12', name: 'Kantoor (Groot)', unit: 'vestigingen', description: 'Kantoren vanaf 10.000 m\u00b2 met meerdere huurders.' },
|
||||
] as const;
|
||||
|
||||
// Distribution types
|
||||
export const DISTRIBUTIONS = [
|
||||
{ id: 'D1', name: 'Afval - Bedrijven', deliveryDays: 6 },
|
||||
{ id: 'D2', name: 'Afval - Huishoudens', deliveryDays: 5 },
|
||||
{ id: 'D3', name: 'Bouw - Renovatie', deliveryDays: 6 },
|
||||
{ id: 'D4', name: 'Bouw - Nieuwbouw', deliveryDays: 6 },
|
||||
{ id: 'D5', name: 'Facilitair (bevoorrading)', deliveryDays: 5 },
|
||||
{ id: 'D6', name: 'Horeca / Groothandel', deliveryDays: 6 },
|
||||
{ id: 'D7', name: 'Pakket', deliveryDays: 6 },
|
||||
{ id: 'D8', name: 'Retail (keten)', deliveryDays: 6 },
|
||||
{ id: 'D9', name: 'Retail (onafhankelijk)', deliveryDays: 5 },
|
||||
{ id: 'D10', name: 'Service & Onderhoud', deliveryDays: 5 },
|
||||
{ id: 'D11', name: 'Specialisten', deliveryDays: 6 },
|
||||
{ id: 'D12', name: 'Supermarktleveringen', deliveryDays: 5 },
|
||||
{ id: 'D13', name: 'Thuisbezorging boodschappen', deliveryDays: 7 },
|
||||
{ id: 'D14', name: 'Tweemans thuisbelevering', deliveryDays: 6 },
|
||||
{ id: 'D15', name: 'Verhuizingen', deliveryDays: 7 },
|
||||
] as const;
|
||||
|
||||
// Time periods
|
||||
export const PERIODS = [
|
||||
{ id: 'P1', name: '0:00 - 6:00', hours: 6 },
|
||||
{ id: 'P2', name: '6:00 - 12:00', hours: 6 },
|
||||
{ id: 'P3', name: '12:00 - 18:00', hours: 6 },
|
||||
{ id: 'P4', name: '18:00 - 0:00', hours: 6 },
|
||||
] as const;
|
||||
|
||||
// Simulation parameters
|
||||
export const SIM_PARAMS = {
|
||||
intervalMinutes: 10,
|
||||
minutesPerHour: 60,
|
||||
hoursPerDay: 24,
|
||||
numSimulations: 1000,
|
||||
};
|
||||
|
||||
// Service levels
|
||||
export const SERVICE_LEVELS = [0.95, 0.90, 0.85, 0.80, 0.75] as const;
|
||||
|
||||
// Default cluster assignments (which vehicle belongs to which cluster)
|
||||
export const DEFAULT_CLUSTERS: Record<string, number> = {
|
||||
V1: 1,
|
||||
V2: 1,
|
||||
V3: 2,
|
||||
V4: 2,
|
||||
V5: 2,
|
||||
V6: 3,
|
||||
};
|
||||
|
||||
// Default service levels per cluster
|
||||
export const DEFAULT_CLUSTER_SERVICE_LEVELS: Record<number, number> = {
|
||||
1: 0.95,
|
||||
2: 0.95,
|
||||
3: 0.95,
|
||||
};
|
||||
|
||||
// Delivery profiles: key is "F{func}_D{dist}", value has stopsPerWeekPerUnit per vehicle and other params
|
||||
// stopsPerWeekPerUnit: array of 6 values (V1-V6)
|
||||
// duration: stop duration in minutes per vehicle (array of 6)
|
||||
// periodDistribution: 4 values for each vehicle that has activity (array of 6 arrays of 4 values)
|
||||
export interface DeliveryProfile {
|
||||
stopsPerWeekPerUnit: number[]; // per vehicle [V1..V6]
|
||||
duration: number[]; // minutes per stop per vehicle [V1..V6]
|
||||
periodDistribution: number[][]; // per vehicle, per period [V1..V6][P1..P4]
|
||||
}
|
||||
|
||||
export const DELIVERY_PROFILES: Record<string, DeliveryProfile> = {
|
||||
// Woningen
|
||||
'F1_D7': { // Woningen - Pakket
|
||||
stopsPerWeekPerUnit: [0, 0, 1.426282, 0, 0, 0],
|
||||
duration: [0, 0, 2, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.4, 0.4, 0.2], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F1_D10': { // Woningen - Service & Onderhoud
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0.038462],
|
||||
duration: [0, 0, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F1_D13': { // Woningen - Thuisbezorging boodschappen
|
||||
stopsPerWeekPerUnit: [0, 0, 0.06, 0, 0, 0],
|
||||
duration: [0, 0, 8, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.3, 0.3, 0.4], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F1_D14': { // Woningen - Tweemans thuisbelevering
|
||||
stopsPerWeekPerUnit: [0, 0, 0.013736, 0.013736, 0, 0],
|
||||
duration: [0, 0, 20, 20, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.4, 0.4, 0.2], [0, 0.4, 0.4, 0.2],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Supermarkt
|
||||
'F2_D10': { // Supermarkt - Service & Onderhoud
|
||||
stopsPerWeekPerUnit: [0, 1, 0, 0, 0, 1],
|
||||
duration: [0, 15, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F2_D12': { // Supermarkt - Supermarktleveringen
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 4.25, 12.75, 0],
|
||||
duration: [0, 0, 0, 30, 45, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.7, 0.2, 0.1],
|
||||
[0, 0.7, 0.2, 0.1], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Retail Food
|
||||
'F3_D10': { // Retail Food - Service & Onderhoud
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0.038462],
|
||||
duration: [0, 0, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F3_D11': { // Retail Food - Specialisten
|
||||
stopsPerWeekPerUnit: [0, 2.5, 2.5, 2.5, 0, 0],
|
||||
duration: [0, 15, 15, 15, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0.7, 0.3, 0],
|
||||
[0, 0.7, 0.3, 0], [0, 0.7, 0.3, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Retail Winkels (Keten)
|
||||
'F4_D8': { // Retail Keten - Retail (keten) — V3 confirmed zero in BP sheet
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 3.6, 0.9, 0],
|
||||
duration: [0, 0, 0, 40, 40, 0], // V4=40, V5=40 per Excel BP Retail Keten
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.7, 0.2, 0.1],
|
||||
[0, 0.7, 0.2, 0.1], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F4_D10': { // Retail Keten - Service & Onderhoud
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 1],
|
||||
duration: [0, 0, 0, 0, 0, 45], // V6=45 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
// Retail Winkels (Onafh.)
|
||||
'F5_D7': { // Retail Onafh - Pakket — V3 periodDist confirmed all-zero in BP sheet
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0],
|
||||
duration: [0, 0, 0, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F5_D9': { // Retail Onafh - Retail (onafhankelijk)
|
||||
stopsPerWeekPerUnit: [0, 0, 5, 4, 1, 0],
|
||||
duration: [0, 0, 15, 15, 15, 0], // V4=15, V5=15 per Excel BP Retail Onafh
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.7, 0.2, 0.1], [0, 0.7, 0.2, 0.1],
|
||||
[0, 0.7, 0.2, 0.1], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F5_D10': { // Retail Onafh - Service & Onderhoud
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0.038462],
|
||||
duration: [0, 0, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
// Restaurant (High)
|
||||
'F6_D6': { // Restaurant High - Horeca/Groothandel
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 11.5, 0, 0],
|
||||
duration: [0, 0, 0, 15, 0, 0], // V4=15 per Excel BP Restaurant (HE)
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.7, 0.3, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F6_D10': { // Restaurant High - Service & Onderhoud
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0.346154],
|
||||
duration: [0, 0, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F6_D11': { // Restaurant High - Specialisten
|
||||
stopsPerWeekPerUnit: [0, 0, 11.5, 0, 0, 0],
|
||||
duration: [0, 0, 15, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.7, 0.3, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Restaurant (Basis)
|
||||
'F7_D6': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 4.8, 0, 0],
|
||||
duration: [0, 0, 0, 15, 0, 0], // V4=15 per Excel BP Restaurant (Basis)
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.7, 0.3, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F7_D10': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0.346154],
|
||||
duration: [0, 0, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F7_D11': { // V3 confirmed zero in BP Restaurant (Basis) sheet
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0.8, 0, 0],
|
||||
duration: [0, 0, 0, 15, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.7, 0.3, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Caf\u00e9
|
||||
'F8_D6': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 4, 0, 0],
|
||||
duration: [0, 0, 0, 30, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.7, 0.3, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F8_D10': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0.346154],
|
||||
duration: [0, 0, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F8_D11': { // V3 confirmed zero in BP Café sheet — profile has no active vehicles
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0],
|
||||
duration: [0, 0, 0, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Hotel
|
||||
'F9_D6': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 3.4, 0, 0],
|
||||
duration: [0, 0, 0, 15, 0, 0], // V4=15 per Excel BP Hotel
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.4, 0.1],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F9_D7': {
|
||||
stopsPerWeekPerUnit: [0, 0, 10, 0, 0, 0],
|
||||
duration: [0, 0, 2, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.4, 0.4, 0.2], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F9_D10': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 2],
|
||||
duration: [0, 0, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F9_D11': {
|
||||
stopsPerWeekPerUnit: [0, 0.425, 13.175, 2, 0, 0],
|
||||
duration: [0, 15, 10, 30, 0, 0], // V4=30 per Excel BP Hotel
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0.5, 0.4, 0.1],
|
||||
[0, 0.5, 0.4, 0.1], [0, 0.5, 0.4, 0.1],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Kantoor Klein
|
||||
'F10_D5': {
|
||||
stopsPerWeekPerUnit: [0, 0, 2.1, 0, 0, 0],
|
||||
duration: [0, 0, 5, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F10_D7': {
|
||||
stopsPerWeekPerUnit: [0, 0, 5.7, 0, 0, 0],
|
||||
duration: [0, 0, 2, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F10_D10': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 0, 0, 0.038462],
|
||||
duration: [0, 0, 0, 0, 0, 60], // V6=60 per Excel Kansen V6
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F10_D11': {
|
||||
stopsPerWeekPerUnit: [0, 0, 2.75, 0, 0, 0],
|
||||
duration: [0, 0, 5, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Kantoor Middel
|
||||
'F11_D5': {
|
||||
stopsPerWeekPerUnit: [0, 0, 2.52, 1.68, 0, 0],
|
||||
duration: [0, 0, 10, 10, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0.5, 0.5, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F11_D6': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 3.68, 0, 0],
|
||||
duration: [0, 0, 0, 10, 0, 0], // V4=10 per Excel BP Kantoor (Middel)
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F11_D7': {
|
||||
stopsPerWeekPerUnit: [0, 0, 11.4, 0, 0, 0],
|
||||
duration: [0, 0, 5, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F11_D10': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 1.3, 0, 3.7],
|
||||
duration: [0, 0, 0, 30, 0, 30], // V4=30, V6=30 per Excel
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F11_D11': {
|
||||
stopsPerWeekPerUnit: [0, 0, 5.52, 0, 0, 0],
|
||||
duration: [0, 0, 10, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
// Kantoor Groot
|
||||
'F12_D5': {
|
||||
stopsPerWeekPerUnit: [0, 0, 13.26, 8.84, 0, 0],
|
||||
duration: [0, 0, 15, 20, 0, 0], // V4=20 per Excel BP Kantoor (Groot)
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0.5, 0.5, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F12_D6': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 16.16, 0, 0],
|
||||
duration: [0, 0, 0, 20, 0, 0], // V4=20 per Excel BP Kantoor (Groot)
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F12_D7': {
|
||||
stopsPerWeekPerUnit: [0, 0, 41.9, 0, 0, 0],
|
||||
duration: [0, 0, 5, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
'F12_D10': {
|
||||
stopsPerWeekPerUnit: [0, 0, 0, 3.28, 0, 9],
|
||||
duration: [0, 0, 0, 30, 0, 30], // V4=30, V6=30 per Excel
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
[0, 0, 0, 0], [0, 0.5, 0.5, 0],
|
||||
],
|
||||
},
|
||||
'F12_D11': {
|
||||
stopsPerWeekPerUnit: [0, 0, 24.24, 0, 0, 0],
|
||||
duration: [0, 0, 15, 0, 0, 0],
|
||||
periodDistribution: [
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
[0, 0.5, 0.5, 0], [0, 0, 0, 0],
|
||||
[0, 0, 0, 0], [0, 0, 0, 0],
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
// Default function counts (from the example scenario in the Excel)
|
||||
export const DEFAULT_FUNCTION_COUNTS: Record<string, number> = {
|
||||
F1: 362, // Woningen
|
||||
F2: 0, // Supermarkt
|
||||
F3: 9, // Retail Food
|
||||
F4: 2, // Retail Winkels (Keten)
|
||||
F5: 27, // Retail Winkels (Onafh.)
|
||||
F6: 0, // Restaurant (High-end)
|
||||
F7: 8, // Restaurant (Basis)
|
||||
F8: 7, // Caf\u00e9
|
||||
F9: 0, // Hotel
|
||||
F10: 0, // Kantoor (Klein)
|
||||
F11: 0, // Kantoor (Middel)
|
||||
F12: 0, // Kantoor (Groot)
|
||||
};
|
||||
@@ -0,0 +1,440 @@
|
||||
/**
|
||||
* Monte Carlo Simulation Engine
|
||||
*
|
||||
* Replicates the Excel model logic for estimating required loading/unloading
|
||||
* space based on stochastic vehicle arrivals. The simulation determines peak
|
||||
* simultaneous vehicle presence across many random trials, then uses percentile
|
||||
* analysis (service levels) to size the required space.
|
||||
*
|
||||
* How it works:
|
||||
* 1. The day is split into 4 periods of 6 hours each, each period subdivided
|
||||
* into 10-minute intervals (36 intervals per period, 144 total per day).
|
||||
* 2. For every Function x Distribution x Vehicle combination, we compute the
|
||||
* probability that a vehicle arrives in any single interval.
|
||||
* 3. In each Monte Carlo iteration we walk through all 144 intervals. For each
|
||||
* interval we draw random numbers against each F×D×V probability to decide
|
||||
* if a vehicle arrives. Arrived vehicles stay for ceil(duration / intervalMinutes)
|
||||
* intervals.
|
||||
* 4. We track the peak number of simultaneously present vehicles per type per
|
||||
* iteration.
|
||||
* 5. After all iterations we sort the peaks and read off percentile values to
|
||||
* determine required capacity at each service level.
|
||||
* 6. Space = peak vehicles × vehicle length. Clusters aggregate vehicles and
|
||||
* each cluster uses its own service level.
|
||||
*/
|
||||
|
||||
import {
|
||||
VEHICLES,
|
||||
FUNCTIONS,
|
||||
DISTRIBUTIONS,
|
||||
PERIODS,
|
||||
SIM_PARAMS,
|
||||
SERVICE_LEVELS,
|
||||
DELIVERY_PROFILES,
|
||||
type DeliveryProfile,
|
||||
} from './model-data';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Types
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface SimulationInput {
|
||||
/** Number of units per function, e.g. { F1: 362, F2: 0, ... } */
|
||||
functionCounts: Record<string, number>;
|
||||
/** Which cluster each vehicle type belongs to, e.g. { V1: 1, V2: 1, V3: 2 } */
|
||||
clusterAssignments: Record<string, number>;
|
||||
/** Service level per cluster, e.g. { 1: 0.95, 2: 0.95, 3: 0.95 } */
|
||||
clusterServiceLevels: Record<number, number>;
|
||||
/** Number of Monte Carlo iterations (default 1000) */
|
||||
numSimulations?: number;
|
||||
}
|
||||
|
||||
export interface SimulationResult {
|
||||
vehicleResults: {
|
||||
vehicleId: string;
|
||||
vehicleName: string;
|
||||
vehicleLength: number;
|
||||
/** Expected total arrivals per day (deterministic mean) */
|
||||
totalArrivalsPerDay: number;
|
||||
/** For each service-level percentage, the peak simultaneous vehicles */
|
||||
maxVehiclesPerServiceLevel: Record<number, number>;
|
||||
/** Required space in metres at the cluster's service level */
|
||||
requiredSpaceM2: number;
|
||||
clusterId: number;
|
||||
}[];
|
||||
clusterResults: {
|
||||
clusterId: number;
|
||||
serviceLevel: number;
|
||||
totalSpaceM2: number;
|
||||
vehicleIds: string[];
|
||||
/** Aggregate peak vehicles at various service levels */
|
||||
maxVehiclesPerServiceLevel: Record<number, number>;
|
||||
}[];
|
||||
/** Grand total space across all clusters (metres) */
|
||||
totalSpaceM2: number;
|
||||
/** Peak space needed per time period (aggregated across all vehicle types) */
|
||||
peakByPeriod: { period: string; space: number }[];
|
||||
/** Service-level curve: space as a function of service level (for graphing) */
|
||||
serviceLevelCurve: { serviceLevel: number; space: number }[];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Internal helper types
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* One F×D×V combination with its pre-computed arrival probabilities per period
|
||||
* and occupancy duration in intervals.
|
||||
*/
|
||||
interface ArrivalSpec {
|
||||
/** Probability of arrival in a single interval, indexed by period (0-3) */
|
||||
kansPerInterval: number[];
|
||||
/** How many intervals this vehicle occupies after arrival */
|
||||
stayIntervals: number;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Core simulation
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function runSimulation(input: SimulationInput): SimulationResult {
|
||||
const {
|
||||
functionCounts,
|
||||
clusterAssignments,
|
||||
clusterServiceLevels,
|
||||
numSimulations = SIM_PARAMS.numSimulations,
|
||||
} = input;
|
||||
|
||||
const intervalMinutes = SIM_PARAMS.intervalMinutes;
|
||||
|
||||
// Total intervals in a day: sum of intervals per period
|
||||
// Each period has (periodHours * 60 / intervalMinutes) intervals
|
||||
const intervalsPerPeriod = PERIODS.map(
|
||||
(p) => (p.hours * SIM_PARAMS.minutesPerHour) / intervalMinutes
|
||||
);
|
||||
const totalIntervals = intervalsPerPeriod.reduce((s, v) => s + v, 0); // 144
|
||||
|
||||
// Build a mapping: period index for each interval in the day (0..143 → 0..3)
|
||||
const intervalToPeriod: number[] = [];
|
||||
for (let p = 0; p < PERIODS.length; p++) {
|
||||
for (let i = 0; i < intervalsPerPeriod[p]; i++) {
|
||||
intervalToPeriod.push(p);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Step 1: Pre-compute arrival specs per vehicle type
|
||||
// -----------------------------------------------------------------------
|
||||
// For each vehicle index (0..5), collect all F×D combinations that produce
|
||||
// arrivals for that vehicle type.
|
||||
|
||||
const vehicleArrivalSpecs: ArrivalSpec[][] = VEHICLES.map(() => []);
|
||||
/** Deterministic expected arrivals per day per vehicle type */
|
||||
const expectedArrivalsPerDay: number[] = new Array(VEHICLES.length).fill(0);
|
||||
|
||||
for (const func of FUNCTIONS) {
|
||||
const numUnits = functionCounts[func.id] ?? 0;
|
||||
if (numUnits === 0) continue;
|
||||
|
||||
for (const dist of DISTRIBUTIONS) {
|
||||
const profileKey = `${func.id}_${dist.id}`;
|
||||
const profile: DeliveryProfile | undefined = DELIVERY_PROFILES[profileKey];
|
||||
if (!profile) continue;
|
||||
|
||||
for (let v = 0; v < VEHICLES.length; v++) {
|
||||
const stopsPerWeekPerUnit = profile.stopsPerWeekPerUnit[v];
|
||||
if (stopsPerWeekPerUnit === 0) continue;
|
||||
|
||||
const periodDist = profile.periodDistribution[v];
|
||||
// Check that this vehicle actually has activity in at least one period
|
||||
const hasActivity = periodDist.some((d) => d > 0);
|
||||
if (!hasActivity) continue;
|
||||
|
||||
const durationMinutes = profile.duration[v];
|
||||
const stayIntervals = durationMinutes > 0 ? Math.ceil(durationMinutes / intervalMinutes) : 1;
|
||||
// If duration is 0 the vehicle still occupies 1 interval (it "passes through")
|
||||
|
||||
// Compute probability per interval for each period
|
||||
// NOTE: The Excel model uses an absolute reference ($F$24) for deliveryDays,
|
||||
// always dividing by 6 regardless of distribution type. We match this behavior.
|
||||
const kansDeliveryDays = 6;
|
||||
const kansPerInterval: number[] = [];
|
||||
for (let p = 0; p < PERIODS.length; p++) {
|
||||
// kans = (stopsPerWeekPerUnit * numUnits / 6) * periodDist[p] / intervalsInPeriod
|
||||
const arrivalsPerDayTotal =
|
||||
(stopsPerWeekPerUnit * numUnits) / kansDeliveryDays;
|
||||
const kans =
|
||||
(arrivalsPerDayTotal * periodDist[p]) / intervalsPerPeriod[p];
|
||||
kansPerInterval.push(kans);
|
||||
|
||||
// Accumulate deterministic expected arrivals for reporting
|
||||
expectedArrivalsPerDay[v] += arrivalsPerDayTotal * periodDist[p];
|
||||
}
|
||||
|
||||
vehicleArrivalSpecs[v].push({ kansPerInterval, stayIntervals });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Correct expectedArrivalsPerDay: the inner loop above accumulates across
|
||||
// all F×D combos which is what we want — the total expected arrivals per day
|
||||
// for this vehicle type. But note we summed across periods already so it is
|
||||
// the full-day total. However the loop adds once per F×D per period, and the
|
||||
// arrivalsPerDayTotal * periodDist already factors in the period fraction, so
|
||||
// the result is correct (sum across all F×D combos and all periods).
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Step 2: Run Monte Carlo simulation
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// For each vehicle type, store the peak simultaneous vehicles per iteration.
|
||||
const peakPerIteration: number[][] = VEHICLES.map(() => new Array(numSimulations));
|
||||
|
||||
// Pre-compute cluster mapping and vehicle indices per cluster
|
||||
const clusterMap = new Map<number, { vehicleIds: string[], vehicleIndices: number[] }>();
|
||||
for (const veh of VEHICLES) {
|
||||
const cid = clusterAssignments[veh.id] ?? 1;
|
||||
if (!clusterMap.has(cid)) clusterMap.set(cid, { vehicleIds: [], vehicleIndices: [] });
|
||||
const cluster = clusterMap.get(cid)!;
|
||||
cluster.vehicleIds.push(veh.id);
|
||||
cluster.vehicleIndices.push(VEHICLES.indexOf(veh));
|
||||
}
|
||||
|
||||
// Flat arrays for percentile computation (Excel-matching approach):
|
||||
// The Excel computes PERCENTILE.INC over (simulations × intervals) per period,
|
||||
// then takes MAX across periods for the final cluster space.
|
||||
const clusterPeriodSpace: Map<number, number[][]> = new Map();
|
||||
const clusterPeriodVehicles: Map<number, number[][]> = new Map();
|
||||
for (const [clusterId] of clusterMap) {
|
||||
clusterPeriodSpace.set(clusterId, PERIODS.map(() => []));
|
||||
clusterPeriodVehicles.set(clusterId, PERIODS.map(() => []));
|
||||
}
|
||||
const overallPeriodSpace: number[][] = PERIODS.map(() => []);
|
||||
|
||||
for (let sim = 0; sim < numSimulations; sim++) {
|
||||
// Track present vehicles per type at each interval for cluster aggregation
|
||||
const vehiclePresentAtInterval: number[][] = VEHICLES.map(() => new Array(totalIntervals).fill(0));
|
||||
|
||||
for (let v = 0; v < VEHICLES.length; v++) {
|
||||
const specs = vehicleArrivalSpecs[v];
|
||||
if (specs.length === 0) {
|
||||
peakPerIteration[v][sim] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
const departures = new Array(totalIntervals + 20).fill(0);
|
||||
let present = 0;
|
||||
let peakVehicles = 0;
|
||||
|
||||
for (let t = 0; t < totalIntervals; t++) {
|
||||
const period = intervalToPeriod[t];
|
||||
present -= departures[t];
|
||||
|
||||
let arrivals = 0;
|
||||
for (let s = 0; s < specs.length; s++) {
|
||||
const spec = specs[s];
|
||||
const prob = spec.kansPerInterval[period];
|
||||
if (prob <= 0) continue;
|
||||
|
||||
if (Math.random() < prob) {
|
||||
arrivals++;
|
||||
departures[t + spec.stayIntervals] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
present += arrivals;
|
||||
vehiclePresentAtInterval[v][t] = present;
|
||||
|
||||
if (present > peakVehicles) {
|
||||
peakVehicles = present;
|
||||
}
|
||||
}
|
||||
|
||||
peakPerIteration[v][sim] = peakVehicles;
|
||||
}
|
||||
|
||||
// Compute per-interval cluster and overall space totals
|
||||
for (let t = 0; t < totalIntervals; t++) {
|
||||
const period = intervalToPeriod[t];
|
||||
|
||||
for (const [clusterId, { vehicleIndices }] of clusterMap) {
|
||||
let space = 0;
|
||||
let vehicles = 0;
|
||||
for (const vi of vehicleIndices) {
|
||||
space += vehiclePresentAtInterval[vi][t] * VEHICLES[vi].length;
|
||||
vehicles += vehiclePresentAtInterval[vi][t];
|
||||
}
|
||||
clusterPeriodSpace.get(clusterId)![period].push(space);
|
||||
clusterPeriodVehicles.get(clusterId)![period].push(vehicles);
|
||||
}
|
||||
|
||||
let overallSpace = 0;
|
||||
for (let v = 0; v < VEHICLES.length; v++) {
|
||||
overallSpace += vehiclePresentAtInterval[v][t] * VEHICLES[v].length;
|
||||
}
|
||||
overallPeriodSpace[period].push(overallSpace);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Step 3: Analyse results — percentiles per vehicle type
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// Sort peaks for each vehicle type to enable percentile lookup
|
||||
const sortedPeaks: number[][] = peakPerIteration.map((peaks) => {
|
||||
const sorted = [...peaks];
|
||||
sorted.sort((a, b) => a - b);
|
||||
return sorted;
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the value at a given percentile (service level) from a sorted array.
|
||||
* Matches Excel's PERCENTILE.INC which uses linear interpolation:
|
||||
* rank = k * (n - 1) (0-based)
|
||||
* result = sorted[floor(rank)] + frac * (sorted[ceil(rank)] - sorted[floor(rank)])
|
||||
*/
|
||||
function percentile(sorted: number[], sl: number): number {
|
||||
if (sorted.length === 0) return 0;
|
||||
if (sorted.length === 1) return sorted[0];
|
||||
const rank = sl * (sorted.length - 1);
|
||||
const lo = Math.floor(rank);
|
||||
const hi = Math.min(lo + 1, sorted.length - 1);
|
||||
const frac = rank - lo;
|
||||
return sorted[lo] + frac * (sorted[hi] - sorted[lo]);
|
||||
}
|
||||
|
||||
// All service levels we want to report on (including those from clusters)
|
||||
const allServiceLevels = new Set<number>(SERVICE_LEVELS as unknown as number[]);
|
||||
for (const sl of Object.values(clusterServiceLevels)) {
|
||||
allServiceLevels.add(sl);
|
||||
}
|
||||
const serviceLevelsArray = Array.from(allServiceLevels).sort((a, b) => a - b);
|
||||
|
||||
// Build vehicle results
|
||||
const vehicleResults: SimulationResult['vehicleResults'] = VEHICLES.map((veh, v) => {
|
||||
const clusterId = clusterAssignments[veh.id] ?? 1;
|
||||
const clusterSL = clusterServiceLevels[clusterId] ?? 0.95;
|
||||
|
||||
const maxVehiclesPerServiceLevel: Record<number, number> = {};
|
||||
for (const sl of serviceLevelsArray) {
|
||||
maxVehiclesPerServiceLevel[Math.round(sl * 100)] = percentile(sortedPeaks[v], sl);
|
||||
}
|
||||
|
||||
const peakAtClusterSL = percentile(sortedPeaks[v], clusterSL);
|
||||
|
||||
return {
|
||||
vehicleId: veh.id,
|
||||
vehicleName: veh.name,
|
||||
vehicleLength: veh.length,
|
||||
totalArrivalsPerDay: Math.round(expectedArrivalsPerDay[v] * 100) / 100,
|
||||
maxVehiclesPerServiceLevel,
|
||||
requiredSpaceM2: peakAtClusterSL * veh.length,
|
||||
clusterId,
|
||||
};
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Step 4: Cluster results
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// Sort flat arrays for percentile computation
|
||||
for (const [, periodArrays] of clusterPeriodSpace) {
|
||||
for (const arr of periodArrays) arr.sort((a, b) => a - b);
|
||||
}
|
||||
for (const [, periodArrays] of clusterPeriodVehicles) {
|
||||
for (const arr of periodArrays) arr.sort((a, b) => a - b);
|
||||
}
|
||||
for (const arr of overallPeriodSpace) arr.sort((a, b) => a - b);
|
||||
|
||||
// Cluster results: Excel uses PERCENTILE.INC over (simulations × intervals)
|
||||
// per period, then takes MAX across periods for the final cluster space.
|
||||
const clusterResults: SimulationResult['clusterResults'] = [];
|
||||
|
||||
for (const [clusterId, { vehicleIds }] of Array.from(clusterMap.entries())) {
|
||||
const sl = clusterServiceLevels[clusterId] ?? 0.95;
|
||||
const periodSpaceArrays = clusterPeriodSpace.get(clusterId)!;
|
||||
const periodVehicleArrays = clusterPeriodVehicles.get(clusterId)!;
|
||||
|
||||
// For each service level, compute max across periods
|
||||
const maxVehiclesPerServiceLevel: Record<number, number> = {};
|
||||
for (const s of serviceLevelsArray) {
|
||||
let maxVehicles = 0;
|
||||
for (let p = 0; p < PERIODS.length; p++) {
|
||||
const val = percentile(periodVehicleArrays[p], s);
|
||||
if (val > maxVehicles) maxVehicles = val;
|
||||
}
|
||||
maxVehiclesPerServiceLevel[Math.round(s * 100)] = maxVehicles;
|
||||
}
|
||||
|
||||
// Total space at the cluster's service level: max across periods
|
||||
let clusterSpace = 0;
|
||||
for (let p = 0; p < PERIODS.length; p++) {
|
||||
const space = percentile(periodSpaceArrays[p], sl);
|
||||
if (space > clusterSpace) clusterSpace = space;
|
||||
}
|
||||
|
||||
clusterResults.push({
|
||||
clusterId,
|
||||
serviceLevel: sl,
|
||||
totalSpaceM2: clusterSpace,
|
||||
vehicleIds,
|
||||
maxVehiclesPerServiceLevel,
|
||||
});
|
||||
}
|
||||
|
||||
// Sort clusters by ID for consistent output
|
||||
clusterResults.sort((a, b) => a.clusterId - b.clusterId);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Step 5: Total space
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
const totalSpaceM2 = clusterResults.reduce((sum, c) => sum + c.totalSpaceM2, 0);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Step 6: Peak by period (for the chart)
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// Peak by period: use PERCENTILE over flat (simulations × intervals) values
|
||||
const peakByPeriod = PERIODS.map((p, i) => ({
|
||||
period: p.name,
|
||||
space: percentile(overallPeriodSpace[i], 0.95),
|
||||
}));
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Step 7: Service level curve (for graphing)
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// Service level curve: for each SL, compute total space = sum of per-cluster spaces.
|
||||
// Each cluster's space = max over periods of PERCENTILE over flat interval values.
|
||||
const serviceLevelCurve: { serviceLevel: number; space: number }[] = [];
|
||||
for (let pct = 50; pct <= 100; pct++) {
|
||||
const sl = pct / 100;
|
||||
let totalSpace = 0;
|
||||
for (const [clusterId] of clusterMap) {
|
||||
const periodArrays = clusterPeriodSpace.get(clusterId)!;
|
||||
let maxPeriodSpace = 0;
|
||||
for (let p = 0; p < PERIODS.length; p++) {
|
||||
const space = percentile(periodArrays[p], sl);
|
||||
if (space > maxPeriodSpace) maxPeriodSpace = space;
|
||||
}
|
||||
totalSpace += maxPeriodSpace;
|
||||
}
|
||||
serviceLevelCurve.push({
|
||||
serviceLevel: sl,
|
||||
space: totalSpace,
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Return
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
vehicleResults,
|
||||
clusterResults,
|
||||
totalSpaceM2,
|
||||
peakByPeriod,
|
||||
serviceLevelCurve,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useCallback, useMemo } from 'react';
|
||||
import {
|
||||
VEHICLES,
|
||||
FUNCTIONS,
|
||||
DEFAULT_FUNCTION_COUNTS,
|
||||
DEFAULT_CLUSTERS,
|
||||
DEFAULT_CLUSTER_SERVICE_LEVELS,
|
||||
SIM_PARAMS,
|
||||
} from '@/lib/model-data';
|
||||
import { runSimulation, type SimulationResult } from '@/lib/simulation';
|
||||
|
||||
export type LayoutType = 'rebel' | 'dmi' | 'webapp';
|
||||
|
||||
export interface SimulationState {
|
||||
// Inputs
|
||||
functionCounts: Record<string, number>;
|
||||
clusterAssignments: Record<string, number>;
|
||||
clusterServiceLevels: Record<number, number>;
|
||||
numSimulations: number;
|
||||
|
||||
// State
|
||||
isRunning: boolean;
|
||||
results: SimulationResult | null;
|
||||
expandedClusters: Record<number, boolean>;
|
||||
|
||||
// Derived
|
||||
clusterIds: number[];
|
||||
totalFunctions: number;
|
||||
computedTotalVehicles: number | null;
|
||||
|
||||
// Handlers
|
||||
handleFunctionCountChange: (funcId: string, value: string) => void;
|
||||
handleClusterMatrixChange: (vehicleId: string, clusterId: number) => void;
|
||||
handleServiceLevelChange: (clusterId: number, value: string) => void;
|
||||
handleRun: () => void;
|
||||
toggleCluster: (clusterId: number) => void;
|
||||
setNumSimulations: (n: number) => void;
|
||||
}
|
||||
|
||||
function getUniqueClusterIds(assignments: Record<string, number>): number[] {
|
||||
return [...new Set(Object.values(assignments))].sort((a, b) => a - b);
|
||||
}
|
||||
|
||||
export function useSimulationState(): SimulationState {
|
||||
const [functionCounts, setFunctionCounts] = useState<Record<string, number>>(
|
||||
() => ({ ...DEFAULT_FUNCTION_COUNTS })
|
||||
);
|
||||
const [clusterAssignments, setClusterAssignments] = useState<Record<string, number>>(
|
||||
() => ({ ...DEFAULT_CLUSTERS })
|
||||
);
|
||||
const [clusterServiceLevels, setClusterServiceLevels] = useState<Record<number, number>>(
|
||||
() => ({ ...DEFAULT_CLUSTER_SERVICE_LEVELS })
|
||||
);
|
||||
const [numSimulations, setNumSimulations] = useState(SIM_PARAMS.numSimulations);
|
||||
const [isRunning, setIsRunning] = useState(false);
|
||||
const [results, setResults] = useState<SimulationResult | null>(null);
|
||||
const [expandedClusters, setExpandedClusters] = useState<Record<number, boolean>>({});
|
||||
|
||||
const clusterIds = useMemo(
|
||||
() => getUniqueClusterIds(clusterAssignments),
|
||||
[clusterAssignments]
|
||||
);
|
||||
|
||||
const totalFunctions = Object.entries(functionCounts).reduce(
|
||||
(sum, [, count]) => sum + count,
|
||||
0
|
||||
);
|
||||
|
||||
const computedTotalVehicles = useMemo(() => {
|
||||
if (results) {
|
||||
return results.vehicleResults.reduce((sum, vr) => sum + vr.totalArrivalsPerDay, 0);
|
||||
}
|
||||
return null;
|
||||
}, [results]);
|
||||
|
||||
const handleFunctionCountChange = useCallback(
|
||||
(funcId: string, value: string) => {
|
||||
const parsed = parseInt(value, 10);
|
||||
setFunctionCounts((prev) => ({
|
||||
...prev,
|
||||
[funcId]: isNaN(parsed) ? 0 : Math.max(0, parsed),
|
||||
}));
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const handleClusterMatrixChange = useCallback(
|
||||
(vehicleId: string, clusterId: number) => {
|
||||
setClusterAssignments((prev) => ({ ...prev, [vehicleId]: clusterId }));
|
||||
setClusterServiceLevels((prev) => {
|
||||
if (prev[clusterId] === undefined) {
|
||||
return { ...prev, [clusterId]: 0.95 };
|
||||
}
|
||||
return prev;
|
||||
});
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const handleServiceLevelChange = useCallback(
|
||||
(clusterId: number, value: string) => {
|
||||
setClusterServiceLevels((prev) => ({
|
||||
...prev,
|
||||
[clusterId]: parseFloat(value),
|
||||
}));
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const handleRun = useCallback(() => {
|
||||
setIsRunning(true);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
const result = runSimulation({
|
||||
functionCounts,
|
||||
clusterAssignments,
|
||||
clusterServiceLevels,
|
||||
numSimulations,
|
||||
});
|
||||
setResults(result);
|
||||
} catch (err) {
|
||||
console.error('Simulation error:', err);
|
||||
} finally {
|
||||
setIsRunning(false);
|
||||
}
|
||||
}, 50);
|
||||
}, [functionCounts, clusterAssignments, clusterServiceLevels, numSimulations]);
|
||||
|
||||
const toggleCluster = useCallback((clusterId: number) => {
|
||||
setExpandedClusters((prev) => ({
|
||||
...prev,
|
||||
[clusterId]: !prev[clusterId],
|
||||
}));
|
||||
}, []);
|
||||
|
||||
return {
|
||||
functionCounts,
|
||||
clusterAssignments,
|
||||
clusterServiceLevels,
|
||||
numSimulations,
|
||||
isRunning,
|
||||
results,
|
||||
expandedClusters,
|
||||
clusterIds,
|
||||
totalFunctions,
|
||||
computedTotalVehicles,
|
||||
handleFunctionCountChange,
|
||||
handleClusterMatrixChange,
|
||||
handleServiceLevelChange,
|
||||
handleRun,
|
||||
toggleCluster,
|
||||
setNumSimulations,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||