mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-27 09:59:08 +00:00
refactor: migrate chakra alert to custom component
This commit is contained in:
committed by
Carlos Valente
parent
10bf4b93ee
commit
c8bf74a719
@@ -14,7 +14,6 @@ interface ExternalLinkProps {
|
|||||||
|
|
||||||
export default function ExternalLink(props: ExternalLinkProps) {
|
export default function ExternalLink(props: ExternalLinkProps) {
|
||||||
const { href, inline, children } = props;
|
const { href, inline, children } = props;
|
||||||
const classes = cx([style.link, inline ? style.inline : null]);
|
|
||||||
|
|
||||||
const handleClick = (event: MouseEvent) => {
|
const handleClick = (event: MouseEvent) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -22,8 +21,14 @@ export default function ExternalLink(props: ExternalLinkProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a href='#!' target='_blank' rel='noreferrer' className={classes} onClick={handleClick}>
|
<a
|
||||||
{children} <IoOpenOutline />
|
href='#!'
|
||||||
|
target='_blank'
|
||||||
|
rel='noreferrer'
|
||||||
|
className={cx([style.link, inline && style.inline])}
|
||||||
|
onClick={handleClick}
|
||||||
|
>
|
||||||
|
{children} <IoOpenOutline style={{ fontSize: '1em' }} />
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,6 @@
|
|||||||
import { useEffect, useMemo } from 'react';
|
import { useEffect, useMemo } from 'react';
|
||||||
import { Controller, useFieldArray, useForm } from 'react-hook-form';
|
import { Controller, useFieldArray, useForm } from 'react-hook-form';
|
||||||
import {
|
import { Button, IconButton, Input, Radio, RadioGroup, Select } from '@chakra-ui/react';
|
||||||
Alert,
|
|
||||||
AlertDescription,
|
|
||||||
AlertIcon,
|
|
||||||
Button,
|
|
||||||
IconButton,
|
|
||||||
Input,
|
|
||||||
Radio,
|
|
||||||
RadioGroup,
|
|
||||||
Select,
|
|
||||||
} from '@chakra-ui/react';
|
|
||||||
import { IoAdd } from '@react-icons/all-files/io5/IoAdd';
|
import { IoAdd } from '@react-icons/all-files/io5/IoAdd';
|
||||||
import { IoTrash } from '@react-icons/all-files/io5/IoTrash';
|
import { IoTrash } from '@react-icons/all-files/io5/IoTrash';
|
||||||
import { Automation, AutomationDTO, HTTPOutput, isHTTPOutput, isOSCOutput, OSCOutput } from 'ontime-types';
|
import { Automation, AutomationDTO, HTTPOutput, isHTTPOutput, isOSCOutput, OSCOutput } from 'ontime-types';
|
||||||
@@ -18,6 +8,7 @@ import { Automation, AutomationDTO, HTTPOutput, isHTTPOutput, isOSCOutput, OSCOu
|
|||||||
import { addAutomation, editAutomation, testOutput } from '../../../../common/api/automation';
|
import { addAutomation, editAutomation, testOutput } from '../../../../common/api/automation';
|
||||||
import { maybeAxiosError } from '../../../../common/api/utils';
|
import { maybeAxiosError } from '../../../../common/api/utils';
|
||||||
import ExternalLink from '../../../../common/components/external-link/ExternalLink';
|
import ExternalLink from '../../../../common/components/external-link/ExternalLink';
|
||||||
|
import Info from '../../../../common/components/info/Info';
|
||||||
import Tag from '../../../../common/components/tag/Tag';
|
import Tag from '../../../../common/components/tag/Tag';
|
||||||
import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings';
|
import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings';
|
||||||
import useCustomFields from '../../../../common/hooks-query/useCustomFields';
|
import useCustomFields from '../../../../common/hooks-query/useCustomFields';
|
||||||
@@ -291,13 +282,10 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
|
|
||||||
<div className={style.innerColumn}>
|
<div className={style.innerColumn}>
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
<Alert status='info' variant='ontime-on-dark-info'>
|
<Info>
|
||||||
<AlertIcon />
|
|
||||||
<AlertDescription>
|
|
||||||
Automation outputs can be used to send data from Ontime to external software.
|
Automation outputs can be used to send data from Ontime to external software.
|
||||||
<ExternalLink href={integrationsDocsUrl}>See the documentation for templates</ExternalLink>
|
<ExternalLink href={integrationsDocsUrl}>See the documentation for templates</ExternalLink>
|
||||||
</AlertDescription>
|
</Info>
|
||||||
</Alert>
|
|
||||||
|
|
||||||
{fieldOutputs.map((output, index) => {
|
{fieldOutputs.map((output, index) => {
|
||||||
if (isOSCOutput(output)) {
|
if (isOSCOutput(output)) {
|
||||||
|
|||||||
+4
-6
@@ -1,6 +1,6 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useFieldArray, useForm } from 'react-hook-form';
|
import { useFieldArray, useForm } from 'react-hook-form';
|
||||||
import { Alert, AlertDescription, AlertIcon, Button, IconButton, Input, Switch } from '@chakra-ui/react';
|
import { Button, IconButton, Input, Switch } from '@chakra-ui/react';
|
||||||
import { IoAdd } from '@react-icons/all-files/io5/IoAdd';
|
import { IoAdd } from '@react-icons/all-files/io5/IoAdd';
|
||||||
import { IoOpenOutline } from '@react-icons/all-files/io5/IoOpenOutline';
|
import { IoOpenOutline } from '@react-icons/all-files/io5/IoOpenOutline';
|
||||||
import { IoTrash } from '@react-icons/all-files/io5/IoTrash';
|
import { IoTrash } from '@react-icons/all-files/io5/IoTrash';
|
||||||
@@ -10,6 +10,7 @@ import { postUrlPresets } from '../../../../common/api/urlPresets';
|
|||||||
import { maybeAxiosError } from '../../../../common/api/utils';
|
import { maybeAxiosError } from '../../../../common/api/utils';
|
||||||
import TooltipActionBtn from '../../../../common/components/buttons/TooltipActionBtn';
|
import TooltipActionBtn from '../../../../common/components/buttons/TooltipActionBtn';
|
||||||
import ExternalLink from '../../../../common/components/external-link/ExternalLink';
|
import ExternalLink from '../../../../common/components/external-link/ExternalLink';
|
||||||
|
import Info from '../../../../common/components/info/Info';
|
||||||
import useUrlPresets from '../../../../common/hooks-query/useUrlPresets';
|
import useUrlPresets from '../../../../common/hooks-query/useUrlPresets';
|
||||||
import { preventEscape } from '../../../../common/utils/keyEvent';
|
import { preventEscape } from '../../../../common/utils/keyEvent';
|
||||||
import { handleLinks } from '../../../../common/utils/linkUtils';
|
import { handleLinks } from '../../../../common/utils/linkUtils';
|
||||||
@@ -108,9 +109,7 @@ export default function UrlPresetsForm() {
|
|||||||
</Panel.InlineElements>
|
</Panel.InlineElements>
|
||||||
</Panel.SubHeader>
|
</Panel.SubHeader>
|
||||||
<Panel.Divider />
|
<Panel.Divider />
|
||||||
<Alert status='info' variant='ontime-on-dark-info'>
|
<Info>
|
||||||
<AlertIcon />
|
|
||||||
<AlertDescription>
|
|
||||||
URL presets are user defined aliases to Ontime URLs
|
URL presets are user defined aliases to Ontime URLs
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@@ -132,8 +131,7 @@ export default function UrlPresetsForm() {
|
|||||||
You will need to save the changes before the presets are functional.
|
You will need to save the changes before the presets are functional.
|
||||||
<br />
|
<br />
|
||||||
<ExternalLink href={urlPresetsDocs}>See the docs</ExternalLink>
|
<ExternalLink href={urlPresetsDocs}>See the docs</ExternalLink>
|
||||||
</AlertDescription>
|
</Info>
|
||||||
</Alert>
|
|
||||||
<Panel.Section>
|
<Panel.Section>
|
||||||
<Panel.Loader isLoading={isLoading} />
|
<Panel.Loader isLoading={isLoading} />
|
||||||
<Panel.Title>
|
<Panel.Title>
|
||||||
|
|||||||
+4
-6
@@ -1,10 +1,11 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Alert, AlertDescription, AlertIcon, Button } from '@chakra-ui/react';
|
import { Button } from '@chakra-ui/react';
|
||||||
import { IoAdd } from '@react-icons/all-files/io5/IoAdd';
|
import { IoAdd } from '@react-icons/all-files/io5/IoAdd';
|
||||||
import { CustomField, CustomFieldLabel } from 'ontime-types';
|
import { CustomField, CustomFieldLabel } from 'ontime-types';
|
||||||
|
|
||||||
import { deleteCustomField, editCustomField, postCustomField } from '../../../../../common/api/customFields';
|
import { deleteCustomField, editCustomField, postCustomField } from '../../../../../common/api/customFields';
|
||||||
import ExternalLink from '../../../../../common/components/external-link/ExternalLink';
|
import ExternalLink from '../../../../../common/components/external-link/ExternalLink';
|
||||||
|
import Info from '../../../../../common/components/info/Info';
|
||||||
import useCustomFields from '../../../../../common/hooks-query/useCustomFields';
|
import useCustomFields from '../../../../../common/hooks-query/useCustomFields';
|
||||||
import { customFieldsDocsUrl } from '../../../../../externals';
|
import { customFieldsDocsUrl } from '../../../../../externals';
|
||||||
import * as Panel from '../../../panel-utils/PanelUtils';
|
import * as Panel from '../../../panel-utils/PanelUtils';
|
||||||
@@ -55,9 +56,7 @@ export default function CustomFields() {
|
|||||||
</Panel.SubHeader>
|
</Panel.SubHeader>
|
||||||
<Panel.Divider />
|
<Panel.Divider />
|
||||||
<Panel.Section>
|
<Panel.Section>
|
||||||
<Alert status='info' variant='ontime-on-dark-info'>
|
<Info>
|
||||||
<AlertIcon />
|
|
||||||
<AlertDescription>
|
|
||||||
Custom fields allow for additional information to be added to an event.
|
Custom fields allow for additional information to be added to an event.
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@@ -67,8 +66,7 @@ export default function CustomFields() {
|
|||||||
<br />
|
<br />
|
||||||
Custom fields can be used width the Integrations feature using the generated key.
|
Custom fields can be used width the Integrations feature using the generated key.
|
||||||
<ExternalLink href={customFieldsDocsUrl}>See the docs</ExternalLink>
|
<ExternalLink href={customFieldsDocsUrl}>See the docs</ExternalLink>
|
||||||
</AlertDescription>
|
</Info>
|
||||||
</Alert>
|
|
||||||
</Panel.Section>
|
</Panel.Section>
|
||||||
<Panel.Section>
|
<Panel.Section>
|
||||||
{isAdding && <CustomFieldForm onSubmit={handleCreate} onCancel={handleCancel} />}
|
{isAdding && <CustomFieldForm onSubmit={handleCreate} onCancel={handleCancel} />}
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { Controller, useForm } from 'react-hook-form';
|
import { Controller, useForm } from 'react-hook-form';
|
||||||
import { Alert, AlertDescription, AlertIcon, Button, Input, Switch } from '@chakra-ui/react';
|
import { Button, Input, Switch } from '@chakra-ui/react';
|
||||||
import { ViewSettings } from 'ontime-types';
|
import { ViewSettings } from 'ontime-types';
|
||||||
|
|
||||||
import { maybeAxiosError } from '../../../../common/api/utils';
|
import { maybeAxiosError } from '../../../../common/api/utils';
|
||||||
import { postViewSettings } from '../../../../common/api/viewSettings';
|
import { postViewSettings } from '../../../../common/api/viewSettings';
|
||||||
import ExternalLink from '../../../../common/components/external-link/ExternalLink';
|
import ExternalLink from '../../../../common/components/external-link/ExternalLink';
|
||||||
|
import Info from '../../../../common/components/info/Info';
|
||||||
import { SwatchPickerRHF } from '../../../../common/components/input/colour-input/SwatchPicker';
|
import { SwatchPickerRHF } from '../../../../common/components/input/colour-input/SwatchPicker';
|
||||||
import useInfo from '../../../../common/hooks-query/useInfo';
|
import useInfo from '../../../../common/hooks-query/useInfo';
|
||||||
import useViewSettings from '../../../../common/hooks-query/useViewSettings';
|
import useViewSettings from '../../../../common/hooks-query/useViewSettings';
|
||||||
import { preventEscape } from '../../../../common/utils/keyEvent';
|
import { preventEscape } from '../../../../common/utils/keyEvent';
|
||||||
|
import { isOntimeCloud } from '../../../../externals';
|
||||||
import * as Panel from '../../panel-utils/PanelUtils';
|
import * as Panel from '../../panel-utils/PanelUtils';
|
||||||
|
|
||||||
const cssOverrideDocsUrl = 'https://docs.getontime.no/features/custom-styling/';
|
const cssOverrideDocsUrl = 'https://docs.getontime.no/features/custom-styling/';
|
||||||
@@ -85,16 +87,19 @@ export default function ViewSettingsForm() {
|
|||||||
</Panel.InlineElements>
|
</Panel.InlineElements>
|
||||||
</Panel.SubHeader>
|
</Panel.SubHeader>
|
||||||
<Panel.Divider />
|
<Panel.Divider />
|
||||||
<Alert status='info' variant='ontime-on-dark-info'>
|
<Info>
|
||||||
<AlertIcon />
|
You can the Ontime views or customise its styles by modifying the provided CSS file.
|
||||||
<AlertDescription>
|
|
||||||
You can the Ontime views or customise its styles by modifying the provided CSS file. <br />
|
|
||||||
The CSS file is in the user directory at {`${info.publicDir}/user/styles/override.css`}
|
|
||||||
<br />
|
<br />
|
||||||
|
{!isOntimeCloud && (
|
||||||
|
<>
|
||||||
<br />
|
<br />
|
||||||
|
The loaded CSS file is in the user directory at{' '}
|
||||||
|
<Panel.BlockQuote>{`${info.publicDir}/user/styles/override.css`}</Panel.BlockQuote>
|
||||||
|
<br />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<ExternalLink href={cssOverrideDocsUrl}>See the docs</ExternalLink>
|
<ExternalLink href={cssOverrideDocsUrl}>See the docs</ExternalLink>
|
||||||
</AlertDescription>
|
</Info>
|
||||||
</Alert>
|
|
||||||
<Panel.Section>
|
<Panel.Section>
|
||||||
<Panel.Loader isLoading={isLoading} />
|
<Panel.Loader isLoading={isLoading} />
|
||||||
<Panel.ListGroup>
|
<Panel.ListGroup>
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
import { Alert, AlertDescription, AlertIcon } from '@chakra-ui/react';
|
|
||||||
|
|
||||||
import * as Panel from '../../panel-utils/PanelUtils';
|
|
||||||
|
|
||||||
import EditorSettingsForm from './EditorSettingsForm';
|
|
||||||
|
|
||||||
export default function InterfacePanel() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Panel.Header>Interface</Panel.Header>
|
|
||||||
<Panel.Section>
|
|
||||||
<Alert status='info' variant='ontime-on-dark-info'>
|
|
||||||
<AlertIcon />
|
|
||||||
<AlertDescription>
|
|
||||||
Interface settings
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
These concern settings that are applied to this user in this browser.
|
|
||||||
<br />
|
|
||||||
It will not affect other users or other browsers.
|
|
||||||
</AlertDescription>
|
|
||||||
</Alert>
|
|
||||||
</Panel.Section>
|
|
||||||
<EditorSettingsForm />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
import { Alert, AlertDescription, AlertIcon } from '@chakra-ui/react';
|
|
||||||
|
|
||||||
import ExternalLink from '../../../../common/components/external-link/ExternalLink';
|
import ExternalLink from '../../../../common/components/external-link/ExternalLink';
|
||||||
|
import Info from '../../../../common/components/info/Info';
|
||||||
const googleSheetDocsUrl = 'https://docs.getontime.no/features/import-spreadsheet-gsheet/';
|
const googleSheetDocsUrl = 'https://docs.getontime.no/features/import-spreadsheet-gsheet/';
|
||||||
|
|
||||||
export default function GSheetInfo() {
|
export default function GSheetInfo() {
|
||||||
return (
|
return (
|
||||||
<Alert status='info' variant='ontime-on-dark-info'>
|
<Info>
|
||||||
<AlertIcon />
|
|
||||||
<AlertDescription>
|
|
||||||
Ontime allows you to synchronize your rundown with a Google Sheet.
|
Ontime allows you to synchronize your rundown with a Google Sheet.
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@@ -15,7 +12,6 @@ export default function GSheetInfo() {
|
|||||||
<br />
|
<br />
|
||||||
Once set up, you will be able to synchronize data between Ontime and your Google Sheet. <br />
|
Once set up, you will be able to synchronize data between Ontime and your Google Sheet. <br />
|
||||||
<ExternalLink href={googleSheetDocsUrl}>See the docs</ExternalLink>
|
<ExternalLink href={googleSheetDocsUrl}>See the docs</ExternalLink>
|
||||||
</AlertDescription>
|
</Info>
|
||||||
</Alert>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user