-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'BubbleDK:main' into main
- Loading branch information
Showing
121 changed files
with
8,745 additions
and
6,820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"create_announcement": 4, | ||
"create_charge": 4, | ||
"delete_charge": 4, | ||
"edit_charge": 4, | ||
"hire_officer": 4, | ||
"set_officer_rank": 4, | ||
"set_officer_roles": 4, | ||
"fire_officer": 4 | ||
} |
110 changes: 55 additions & 55 deletions
110
web/build/assets/index-3d12f69b.js → web/build/assets/index-0518d1ff.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
<!doctype html> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css" /> | ||
<title>Bubble MDT</title> | ||
<script type="module" crossorigin src="./assets/index-3d12f69b.js"></script> | ||
<link rel="stylesheet" href="./assets/index-40fcadd0.css"> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
|
||
</body> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css" | ||
/> | ||
<title>Bubble MDT</title> | ||
<script type="module" crossorigin src="./assets/index-0518d1ff.js"></script> | ||
<link rel="stylesheet" href="./assets/index-eeb3b938.css"> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
<!doctype html> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css" /> | ||
<title>Bubble MDT</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css" | ||
/> | ||
<title>Bubble MDT</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export const capitalizeFirstLetter = (str: string): string => { | ||
if (str.length === 0) { | ||
return str; | ||
} | ||
if (str.length === 0) { | ||
return str; | ||
} | ||
|
||
return str.charAt(0).toUpperCase() + str.slice(1); | ||
return str.charAt(0).toUpperCase() + str.slice(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { Call, Unit, UnitsObject } from '../typings'; | ||
|
||
export interface CallsResponse extends Omit<Call, 'units'> { | ||
units: UnitsObject; | ||
units: UnitsObject; | ||
} | ||
|
||
export const convertUnitsToArray = (units: UnitsObject): Unit[] => { | ||
if (!units) return []; | ||
return Object.entries(units).map((unit) => ({ id: +unit[0], ...unit[1] })); | ||
if (!units) return []; | ||
return Object.entries(units).map((unit) => ({ id: +unit[0], ...unit[1] })); | ||
}; | ||
|
||
export const convertCalls = (resp: { [key: string]: CallsResponse } | CallsResponse[]): Call[] => { | ||
if (Array.isArray(resp)) return resp.map((entry) => ({ ...entry, units: convertUnitsToArray(entry.units) })); | ||
return Object.entries(resp).map((entry: [string, CallsResponse]) => { | ||
const call: Call = { ...entry[1], units: [] }; | ||
call.units = convertUnitsToArray(entry[1].units); | ||
if (Array.isArray(resp)) return resp.map((entry) => ({ ...entry, units: convertUnitsToArray(entry.units) })); | ||
return Object.entries(resp).map((entry: [string, CallsResponse]) => { | ||
const call: Call = { ...entry[1], units: [] }; | ||
call.units = convertUnitsToArray(entry[1].units); | ||
|
||
return call; | ||
}); | ||
return call; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Character } from "../typings"; | ||
import permissions, { PermissionKey } from "../permissions"; | ||
|
||
export const hasPermission = ( | ||
character: Character, | ||
permission: PermissionKey | PermissionKey[] | ||
) => { | ||
if (!Array.isArray(permission)) { | ||
const perm = permissions[permission]; | ||
|
||
return character.grade >= perm; | ||
} | ||
|
||
let failedPerms = 0; | ||
for (let i = 0; i < permission.length; i++) { | ||
const perm = permissions[permission[i]]; | ||
|
||
if (character.grade < perm) { | ||
failedPerms++; | ||
} | ||
|
||
if (failedPerms === permission.length) { | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,105 @@ | ||
import React from 'react'; | ||
import { ActionIcon, Button, Drawer, Select, Stack, Tooltip } from '@mantine/core'; | ||
import { IconTools } from '@tabler/icons-react'; | ||
import { debugData } from '../../utils/debugData'; | ||
import { Call } from '../../typings'; | ||
import { useAppVisibilityStore } from '../../stores'; | ||
import React from "react"; | ||
import { | ||
ActionIcon, | ||
Button, | ||
Drawer, | ||
Select, | ||
Stack, | ||
Tooltip, | ||
} from "@mantine/core"; | ||
import { IconTools } from "@tabler/icons-react"; | ||
import { debugData } from "../../utils/debugData"; | ||
import { Call } from "../../typings"; | ||
import { useAppVisibilityStore } from "../../stores"; | ||
|
||
const setBackground = (bg: string) => { | ||
const root = document.getElementById('root'); | ||
const root = document.getElementById("root"); | ||
|
||
// https://i.imgur.com/iPTAdYV.png - Night time img | ||
// https://i.imgur.com/3pzRj9n.png - Day time | ||
root!.style.backgroundImage = `url(${bg})`; | ||
root!.style.backgroundSize = 'cover'; | ||
root!.style.backgroundRepeat = 'no-repeat'; | ||
root!.style.backgroundPosition = 'center'; | ||
// https://i.imgur.com/iPTAdYV.png - Night time img | ||
// https://i.imgur.com/3pzRj9n.png - Day time | ||
root!.style.backgroundImage = `url(${bg})`; | ||
root!.style.backgroundSize = "cover"; | ||
root!.style.backgroundRepeat = "no-repeat"; | ||
root!.style.backgroundPosition = "center"; | ||
}; | ||
|
||
const Dev: React.FC = () => { | ||
const [opened, setOpened] = React.useState(false); | ||
const toggleVisibility = useAppVisibilityStore((state) => state.toggle); | ||
const [opened, setOpened] = React.useState(false); | ||
const toggleVisibility = useAppVisibilityStore((state) => state.toggle); | ||
|
||
return ( | ||
<> | ||
<Tooltip label="Developer drawer" position="bottom"> | ||
<ActionIcon | ||
onClick={() => setOpened(true)} | ||
radius="xl" | ||
variant="filled" | ||
color="orange" | ||
sx={{ position: 'absolute', bottom: 0, right: 0, width: 50, height: 50 }} | ||
size="xl" | ||
mr={50} | ||
mb={50} | ||
> | ||
<IconTools /> | ||
</ActionIcon> | ||
</Tooltip> | ||
return ( | ||
<> | ||
<Tooltip label='Developer drawer' position='bottom'> | ||
<ActionIcon | ||
onClick={() => setOpened(true)} | ||
radius='xl' | ||
variant='filled' | ||
color='orange' | ||
sx={{ | ||
position: "absolute", | ||
bottom: 0, | ||
right: 0, | ||
width: 50, | ||
height: 50, | ||
}} | ||
size='xl' | ||
mr={50} | ||
mb={50} | ||
> | ||
<IconTools /> | ||
</ActionIcon> | ||
</Tooltip> | ||
|
||
<Drawer | ||
position="left" | ||
onClose={() => setOpened(false)} | ||
opened={opened} | ||
title="Developer drawer" | ||
padding="xl" | ||
size="xs" | ||
zIndex={1} | ||
> | ||
<Stack> | ||
<Select | ||
onChange={(val) => setBackground(val as string)} | ||
defaultValue="https://i.imgur.com/3pzRj9n.png" | ||
data={[ | ||
{ label: 'Day', value: 'https://i.imgur.com/3pzRj9n.png' }, | ||
{ label: 'Night', value: 'https://i.imgur.com/iPTAdYV.png' }, | ||
]} | ||
label="Background" | ||
/> | ||
<Button onClick={() => toggleVisibility()}>Toggle MDT</Button> | ||
<Button | ||
onClick={() => | ||
debugData<Call>([ | ||
{ | ||
action: 'addCall', | ||
data: { | ||
id: 4, | ||
offense: 'Vehicle theft', | ||
code: '10-15', | ||
blip: 51, | ||
coords: [1, 1], | ||
linked: false, | ||
time: Date.now(), | ||
location: 'Strawberry Ave', | ||
info: [ | ||
{ label: 'Sultan RS', icon: 'car' }, | ||
{ label: 'XYZ 123', icon: 'badge-tm' }, | ||
], | ||
units: [], | ||
}, | ||
}, | ||
]) | ||
} | ||
> | ||
Add call | ||
</Button> | ||
</Stack> | ||
</Drawer> | ||
</> | ||
); | ||
<Drawer | ||
position='left' | ||
onClose={() => setOpened(false)} | ||
opened={opened} | ||
title='Developer drawer' | ||
padding='xl' | ||
size='xs' | ||
zIndex={1} | ||
> | ||
<Stack> | ||
<Select | ||
onChange={(val) => setBackground(val as string)} | ||
defaultValue='https://i.imgur.com/3pzRj9n.png' | ||
data={[ | ||
{ label: "Day", value: "https://i.imgur.com/3pzRj9n.png" }, | ||
{ label: "Night", value: "https://i.imgur.com/iPTAdYV.png" }, | ||
]} | ||
label='Background' | ||
/> | ||
<Button onClick={() => toggleVisibility()}>Toggle MDT</Button> | ||
<Button | ||
onClick={() => | ||
debugData<Call>([ | ||
{ | ||
action: "addCall", | ||
data: { | ||
id: 4, | ||
offense: "Vehicle theft", | ||
code: "10-15", | ||
blip: 51, | ||
coords: [1, 1], | ||
linked: false, | ||
time: Date.now(), | ||
location: "Strawberry Ave", | ||
info: [ | ||
{ label: "Sultan RS", icon: "car" }, | ||
{ label: "XYZ 123", icon: "badge-tm" }, | ||
], | ||
units: [], | ||
}, | ||
}, | ||
]) | ||
} | ||
> | ||
Add call | ||
</Button> | ||
</Stack> | ||
</Drawer> | ||
</> | ||
); | ||
}; | ||
|
||
export default Dev; | ||
export default Dev; |
Oops, something went wrong.