change name and other small things

This commit is contained in:
grimhilt 2023-08-29 21:20:00 +02:00
parent f8c9b93dad
commit 35ff9e643d
12 changed files with 18 additions and 83 deletions

View File

@ -1,5 +1,5 @@
{
"name": "signage",
"name": "Artemio",
"version": "1.1.0",
"private": true,
"dependencies": {

View File

@ -5,11 +5,11 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Signage" />
<meta name="description" content="Artemio" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<meta name="darkreader" content="disable" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Signage</title>
<title>Artemio</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -1,6 +1,6 @@
{
"short_name": "signage",
"name": "signage",
"short_name": "artemio",
"name": "artemio",
"icons": [
{
"src": "favicon.ico",

View File

@ -70,7 +70,7 @@ const HeaderSearch = () => {
<Group>
<Avatar src={Logo} size={30} />
<UnstyledButton onClick={() => navigate('/')} className={classes.link}>
<Title order={1}>Signage</Title>
<Title order={1}>Artemio</Title>
</UnstyledButton>
</Group>

View File

@ -62,7 +62,7 @@ const Authentication = ({ redirect }) => {
align="center"
sx={(theme) => ({ fontFamily: `Greycliff CF, ${theme.fontFamily}`, fontWeight: 900 })}
>
Connect to signage
Connect to Artemio
</Title>
<Paper withBorder shadow="md" p={30} mt={30} radius="md">

View File

@ -161,9 +161,6 @@ const Content = ({ form, playlistId, playlist }) => {
form.getInputProps(`files.${index}.seconds`).errors && 'This field is required'
}
/>
<Text>
Display time: {parseTime(form.getInputProps(`files.${index}.seconds`).value)}
</Text>
<ActionIcon color="red" variant="light" size="lg" onClick={() => handleDelete(index)}>
<IconTrash size="1rem" />
</ActionIcon>

View File

@ -22,7 +22,7 @@ const Playlist = (item) => {
const toggleActivate = () => {
setIsLoading(true);
(isActive ? API.disactivate : API.activate)(id)
(isActive ? API.playlists.disactivate : API.playlists.activate)(id)
.then((res) => {
if (res.status === 200) {
setIsActive(!isActive);

View File

@ -3,7 +3,7 @@ import PlaylistViewEditor from './playlist-view-editor';
import API from '../../services/api';
const ModalCreatePlaylist = ({ opened, handler, addPlaylist }) => {
const validated = (item) => {
const validate = (item) => {
if (item) {
addPlaylist(item);
}
@ -26,7 +26,7 @@ const ModalCreatePlaylist = ({ opened, handler, addPlaylist }) => {
<PlaylistViewEditor
buttonText="Create"
APICall={API.playlists.create}
handler={(item) => validated(item)}
handler={(item) => validate(item)}
/>
</Modal.Body>
</Modal.Content>

View File

@ -1,64 +0,0 @@
import { MultiSelect } from '@mantine/core';
import { useEffect, useState } from 'react';
import setNotification from '../errors/error-notification';
import API from '../../services/api';
const RoleSelector = ({ defaultRoles, label, value, setValue }) => {
const [data, setData] = useState([]);
const [search, setSearch] = useState();
const addRoles = (roles) => {
if (!roles) return;
for (let i = 0; i < roles.length; i++) {
const role = roles[i];
if (!data.find((r) => r.id === role.id)) {
role.label = role.name;
role.value = role.id.toString();
setData((prev) => [...prev, role]);
}
}
};
useEffect(() => {
API.roles
.search(search)
.then((res) => {
if (res.status === 200) {
addRoles(res.data);
} else {
setNotification(true, res);
}
})
.catch((err) => {
setNotification(true, err);
});
// eslint-disable-next-line
}, [search]);
useEffect(() => {
addRoles(defaultRoles);
// eslint-disable-next-line
}, [defaultRoles]);
// creatable
// getCreateLabel={(query) => `+ Create ${query}`}
// onCreate={(query) => {
// const item = { value: query, label: query };
// setData((current) => [...current, item]);
// return item;
// }}
return (
<MultiSelect
label={label}
data={data}
searchable
searchValue={search}
onSearchChange={setSearch}
value={value}
onChange={setValue}
maxDropdownHeight={160}
/>
);
};
export default RoleSelector;

View File

@ -3,8 +3,10 @@ import API from '../../services/api';
import PlaylistViewEditor from './playlist-view-editor';
const ModalUpdatePlaylist = ({ item, opened, handler, updatePlaylist }) => {
const validated = (playlist) => {
updatePlaylist(playlist);
const validate = (playlist) => {
if (playlist) {
updatePlaylist(playlist);
}
handler();
};
@ -25,7 +27,7 @@ const ModalUpdatePlaylist = ({ item, opened, handler, updatePlaylist }) => {
item={item}
buttonText="Update"
APICall={API.playlists.update}
handler={(playlist) => validated(playlist)}
handler={(playlist) => validate(playlist)}
/>
</Modal.Body>
</Modal.Content>

View File

@ -64,10 +64,10 @@ const API = {
},
files: {
upload(data) {
return caller().post('/file', data);
return caller().post('/files', data);
},
list() {
return caller().get('/file');
return caller().get('/files');
},
},
profile() {

View File

@ -4,7 +4,7 @@ module.exports = function(app) {
app.use(
'/api',
createProxyMiddleware({
target: 'http://192.168.2.183:5500',
target: 'http://127.0.0.1:5500',
changeOrigin: true,
})
);