Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
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';
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';
Expand Down Expand Up @@ -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) => ({
Expand All @@ -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>
<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}>
<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>
<div>
<span className={style.label}>Select View or URL Preset</span>
<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}>
{origin}
<span className={style.origin}>{origin}</span>
<Select
fluid
options={viewOptions}
Expand All @@ -115,7 +129,7 @@ export function RedirectClientModal({ id, isOpen, name, currentPath, origin, onC
Redirect <IoArrowForward />
</Button>
</div>
</div>
</section>
</>
}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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={
<>
Expand Down
12 changes: 9 additions & 3 deletions apps/client/src/common/components/dialog/Dialog.module.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
.dialog {
position: fixed;
top: 10%;
top: 10vh;
left: 50%;

transform: translateX(-50%);

box-sizing: border-box;
width: min(600px, 90vw);
max-height: calc(90vh - 1rem);
display: flex;
flex-direction: column;
padding-inline: 1rem;
min-width: min(600px, 90vw);

background-color: $gray-1250;
color: $ui-white;
Expand Down Expand Up @@ -43,7 +47,8 @@
flex-direction: column;
gap: 0.5rem;

max-height: min(80vh, 600px);
flex: 1;
min-height: 0;
overflow-y: auto;
}

Expand All @@ -53,4 +58,5 @@
align-items: center;
justify-content: end;
gap: 1rem;
flex-wrap: wrap;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,15 @@
outline: none;
box-shadow: 0 1px 0 0 currentColor;
}

&:hover .icon,
&:focus-visible .icon {
transform: translateX(0.25rem);
}
}

.icon {
flex: 0 0 1.5em;
font-size: 1em;
transition: transform $transition-time-action;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MouseEvent, ReactNode } from 'react';
import { IoOpenOutline } from 'react-icons/io5';
import { HiArrowLongRight } from 'react-icons/hi2';

import { openLink } from '../../../utils/linkUtils';
import { cx } from '../../../utils/styleUtils';
Expand All @@ -10,9 +10,10 @@ interface ExternalLinkProps {
href: string;
children: ReactNode;
inline?: boolean;
className?: string;
}

export default function ExternalLink({ href, inline, children }: ExternalLinkProps) {
export default function ExternalLink({ href, inline, className, children }: ExternalLinkProps) {
const handleClick = (event: MouseEvent) => {
event.preventDefault();
openLink(href);
Expand All @@ -23,10 +24,11 @@ export default function ExternalLink({ href, inline, children }: ExternalLinkPro
href='#!'
target='_blank'
rel='noreferrer'
className={cx([style.link, inline && style.inline])}
className={cx([style.link, inline && style.inline, className])}
onClick={handleClick}
>
{children} <IoOpenOutline style={{ fontSize: '1em' }} />
{children}
<HiArrowLongRight className={style.icon} />
</a>
);
}
Loading
Loading