mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 04:13:47 +00:00
refactor(settings): polish settings UI
This commit is contained in:
committed by
Carlos Valente
parent
f0c284b708
commit
24be49ef66
@@ -1,24 +1,82 @@
|
||||
.section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem;
|
||||
background-color: $gray-1300;
|
||||
border: 1px solid $gray-1100;
|
||||
border-radius: $component-border-radius-md;
|
||||
}
|
||||
|
||||
.sectionHeader {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.separator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
color: $gray-500;
|
||||
font-size: $inner-section-text-size;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: '';
|
||||
flex: 1;
|
||||
border-top: 1px solid $gray-1100;
|
||||
}
|
||||
}
|
||||
|
||||
.textEntry {
|
||||
grid-area: input;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: $label-gray;
|
||||
}
|
||||
|
||||
.inlineEntry {
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
'label label'
|
||||
'input btn';
|
||||
grid-template-columns: 1fr auto;
|
||||
column-gap: 0.5rem;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.redirect {
|
||||
grid-area: btn;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: $label-gray;
|
||||
color: $gray-200;
|
||||
font-size: $text-body-size;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: $gray-500;
|
||||
font-size: $inner-section-text-size;
|
||||
}
|
||||
|
||||
.origin {
|
||||
flex: 0 0 auto;
|
||||
color: $gray-500;
|
||||
font-size: $inner-section-text-size;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: $min-tablet) {
|
||||
.inlineEntry {
|
||||
grid-template-columns: 1fr;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.redirect {
|
||||
align-self: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { IoArrowForward } from 'react-icons/io5';
|
||||
|
||||
import { baseURI } from '../../../externals';
|
||||
import { navigatorConstants } from '../../../viewerConfig';
|
||||
import useUrlPresets from '../../hooks-query/useUrlPresets';
|
||||
import { setClientRemote } from '../../hooks/useSocket';
|
||||
@@ -8,7 +9,7 @@ import Button from '../buttons/Button';
|
||||
import Dialog from '../dialog/Dialog';
|
||||
import Info from '../info/Info';
|
||||
import Input from '../input/input/Input';
|
||||
import AppLink from '../link/app-link/AppLink';
|
||||
import ExternalLink from '../link/external-link/ExternalLink';
|
||||
import Select from '../select/Select';
|
||||
|
||||
import style from './RedirectClientModal.module.scss';
|
||||
@@ -44,6 +45,7 @@ export function RedirectClientModal({ id, isOpen, name, currentPath, origin, onC
|
||||
};
|
||||
|
||||
const enabledPresets = data.filter((preset) => preset.enabled);
|
||||
const settingsUrl = `${window.location.origin}${baseURI}/?settings=sharing__presets`;
|
||||
|
||||
const viewOptions = [
|
||||
...navigatorConstants.map((view) => ({
|
||||
@@ -66,34 +68,46 @@ export function RedirectClientModal({ id, isOpen, name, currentPath, origin, onC
|
||||
bodyElements={
|
||||
<>
|
||||
<Info>
|
||||
Remotely redirect the client to a different URL. <br />
|
||||
Either by entering a custom path or selecting a URL Preset.
|
||||
<br />
|
||||
<br />
|
||||
<AppLink search='settings=sharing__presets'>Manage URL Presets</AppLink>
|
||||
<Info.Body>
|
||||
Remotely redirect the client to a different URL. Choose a custom path or select a URL Preset.
|
||||
</Info.Body>
|
||||
<Info.Footer>
|
||||
<ExternalLink href={settingsUrl}>Manage URL Presets</ExternalLink>
|
||||
</Info.Footer>
|
||||
</Info>
|
||||
<div className={style.inlineEntry}>
|
||||
<span className={style.label}>Enter custom path</span>
|
||||
<label className={style.textEntry}>
|
||||
{origin}
|
||||
<Input placeholder='eg. /timer' fluid value={path} onChange={(event) => setPath(event.target.value)} />
|
||||
</label>
|
||||
<Button
|
||||
variant='primary'
|
||||
aria-label='Redirect'
|
||||
disabled={path === currentPath || path === ''}
|
||||
className={style.redirect}
|
||||
onClick={() => handleRedirect(path)}
|
||||
>
|
||||
Redirect
|
||||
<IoArrowForward />
|
||||
</Button>
|
||||
</div>
|
||||
<div>
|
||||
<span className={style.label}>Select View or URL Preset</span>
|
||||
<section className={style.section}>
|
||||
<div className={style.sectionHeader}>
|
||||
<span className={style.label}>Enter custom path</span>
|
||||
<span className={style.description}>Type the path the client should open.</span>
|
||||
</div>
|
||||
<div className={style.inlineEntry}>
|
||||
<label className={style.textEntry}>
|
||||
{origin}
|
||||
<span className={style.origin}>{origin}</span>
|
||||
<Input placeholder='eg. /timer' fluid value={path} onChange={(event) => setPath(event.target.value)} />
|
||||
</label>
|
||||
<Button
|
||||
variant='primary'
|
||||
aria-label='Redirect to custom path'
|
||||
disabled={path === currentPath || path === ''}
|
||||
className={style.redirect}
|
||||
onClick={() => handleRedirect(path)}
|
||||
>
|
||||
Redirect
|
||||
<IoArrowForward />
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
<div className={style.separator} role='separator'>
|
||||
<span>Or</span>
|
||||
</div>
|
||||
<section className={style.section}>
|
||||
<div className={style.sectionHeader}>
|
||||
<span className={style.label}>Select view or URL Preset</span>
|
||||
<span className={style.description}>Choose from the available destinations.</span>
|
||||
</div>
|
||||
<div className={style.inlineEntry}>
|
||||
<label className={style.textEntry}>
|
||||
<span className={style.origin}>{origin}</span>
|
||||
<Select
|
||||
fluid
|
||||
options={viewOptions}
|
||||
@@ -115,7 +129,7 @@ export function RedirectClientModal({ id, isOpen, name, currentPath, origin, onC
|
||||
Redirect <IoArrowForward />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
@use '../../../theme/ontimeStyles' as *;
|
||||
|
||||
.form {
|
||||
padding: 0.25rem 0.5rem 0.5rem;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
color: $label-gray;
|
||||
font-size: $inner-section-text-size;
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import { setClientRemote } from '../../hooks/useSocket';
|
||||
import Dialog from '../dialog/Dialog';
|
||||
import Input from '../input/input/Input';
|
||||
|
||||
import style from './RenameClientModal.module.scss';
|
||||
|
||||
interface RenameClientModalProps {
|
||||
id: string;
|
||||
name?: string;
|
||||
@@ -31,9 +33,22 @@ export function RenameClientModal({ id, name: currentName = '', isOpen, onClose
|
||||
isOpen={isOpen}
|
||||
title={`Rename Client: ${currentName}`}
|
||||
showCloseButton
|
||||
showBackdrop
|
||||
onClose={onClose}
|
||||
bodyElements={
|
||||
<Input height='large' placeholder='New name' value={name} onChange={(event) => setName(event.target.value)} />
|
||||
<div className={style.form}>
|
||||
<label className={style.label}>
|
||||
Client name
|
||||
<Input
|
||||
height='large'
|
||||
fluid
|
||||
autoComplete='off'
|
||||
placeholder='New name'
|
||||
value={name}
|
||||
onChange={(event) => setName(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
footerElements={
|
||||
<>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.dialog {
|
||||
position: fixed;
|
||||
top: 1rem;
|
||||
top: 10vh;
|
||||
left: 50%;
|
||||
|
||||
transform: translateX(-50%);
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
color: $ui-white;
|
||||
}
|
||||
|
||||
.active {
|
||||
border: 1px solid $green-700;
|
||||
color: $green-400;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background-color: $orange-1300;
|
||||
color: $orange-300;
|
||||
|
||||
@@ -6,7 +6,7 @@ import style from './Tag.module.scss';
|
||||
|
||||
interface TagProps {
|
||||
className?: string;
|
||||
variant?: 'default' | 'warning';
|
||||
variant?: 'default' | 'active' | 'warning';
|
||||
}
|
||||
|
||||
export default function Tag({ className, variant = 'default', children }: PropsWithChildren<TagProps>) {
|
||||
|
||||
Reference in New Issue
Block a user