chore(web): add prettier and format

This commit is contained in:
Luke
2022-08-27 15:58:36 +02:00
parent cc76d23419
commit 4a5251b60b
44 changed files with 2933 additions and 1984 deletions

View File

@@ -1,20 +1,14 @@
import {
useToast,
type ToastPositionWithLogical,
Box,
HStack,
Text,
} from "@chakra-ui/react";
import { useNuiEvent } from "../../hooks/useNuiEvent";
import { IconProp } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useToast, type ToastPositionWithLogical, Box, HStack, Text } from '@chakra-ui/react';
import { useNuiEvent } from '../../hooks/useNuiEvent';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
export interface NotificationProps {
title?: string;
description?: string;
duration?: number;
position?: ToastPositionWithLogical;
status?: "info" | "warning" | "success" | "error";
status?: 'info' | 'warning' | 'success' | 'error';
id?: number;
}
@@ -33,31 +27,20 @@ export interface CustomNotificationProps {
const Notifications: React.FC = () => {
const toast = useToast();
useNuiEvent<CustomNotificationProps>("customNotify", (data) => {
useNuiEvent<CustomNotificationProps>('customNotify', (data) => {
if (!data.title && !data.description) return;
if (data.id && toast.isActive(data.id)) return;
if (!data.icon) {
data.icon =
data.type === "error"
? "circle-xmark"
: data.type === "success"
? "circle-check"
: "circle-info";
data.icon = data.type === 'error' ? 'circle-xmark' : data.type === 'success' ? 'circle-check' : 'circle-info';
}
const id = data.id;
toast({
id,
duration: data.duration || 3000,
position: data.position || "top-right",
position: data.position || 'top-right',
render: () => (
<Box
className={`toast-${data.type || "inform"}`}
style={data.style}
p={2}
borderRadius="sm"
boxShadow="md"
>
<Box className={`toast-${data.type || 'inform'}`} style={data.style} p={2} borderRadius="sm" boxShadow="md">
<HStack spacing={0}>
{data.icon && (
<FontAwesomeIcon
@@ -78,7 +61,7 @@ const Notifications: React.FC = () => {
});
});
useNuiEvent<NotificationProps>("notify", (data) => {
useNuiEvent<NotificationProps>('notify', (data) => {
if (!data.title && !data.description) return;
if (data.id && toast.isActive(data.id)) return;
const id = data.id;
@@ -87,7 +70,7 @@ const Notifications: React.FC = () => {
title: data.title,
description: data.description,
duration: data.duration || 4000,
position: data.position || "top-right",
position: data.position || 'top-right',
status: data.status,
});
});