Converting Theme.js to typescript so we can use shorthands like Card.Icon.
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

This commit is contained in:
Roland 2025-12-07 11:32:07 -07:00 • committed by lrnselfreliance
parent c715c4d8ac
commit a92104728d
34 changed files with 936 additions and 710 deletions

View file

@ -30,7 +30,7 @@ import {
TableHeaderCell,
TableRow
} from "semantic-ui-react";
import {Button, Header, Modal, ModalActions, ModalContent, ModalHeader, Placeholder, Segment, Table} from "../Theme";
import {Button, Header, Modal, Placeholder, Segment, Table} from "../Theme";
import {useDownloads} from "../../hooks/customHooks";
import {
EditArchiveDownloadForm,
@ -143,13 +143,13 @@ function RecurringDownloadRow({download, fetchDownloads, onDelete}) {
open={errorModalOpen}
trigger={<Button icon='exclamation circle' color='orange'/>}
>
<ModalHeader>Download Error</ModalHeader>
<ModalContent>
<Modal.Header>Download Error</Modal.Header>
<Modal.Content>
<pre style={{overflowX: 'scroll'}}>{error}</pre>
</ModalContent>
<ModalActions>
</Modal.Content>
<Modal.Actions>
<SButton onClick={handleEditClose}>Close</SButton>
</ModalActions>
</Modal.Actions>
</Modal>;
const editButton = <Button icon='edit' onClick={handleEditOpen}/>;
@ -221,10 +221,10 @@ function RecurringDownloadRow({download, fetchDownloads, onDelete}) {
open={editModalOpen}
onClose={handleEditClose}
>
<ModalHeader>Edit Download</ModalHeader>
<ModalContent>
<Modal.Header>Edit Download</Modal.Header>
<Modal.Content>
{editForm}
</ModalContent>
</Modal.Content>
</Modal>;
return <TableRow>
@ -357,10 +357,10 @@ class OnceDownloadRow extends React.Component {
closeIcon
trigger={<Button icon='exclamation circle' color='red'/>}
>
<ModalHeader>Download Error</ModalHeader>
<ModalContent>
<Modal.Header>Download Error</Modal.Header>
<Modal.Content>
<pre style={{overflowX: 'scroll'}}>{error}</pre>
</ModalContent>
</Modal.Content>
</Modal>
)
}
@ -375,8 +375,8 @@ class OnceDownloadRow extends React.Component {
open={this.state.editModalOpen}
onClose={this.handleEditClose}
>
<ModalHeader>Edit Video Download</ModalHeader>
<ModalContent>
<Modal.Header>Edit Video Download</Modal.Header>
<Modal.Content>
<EditVideosDownloadForm
download={{
urls: url,
@ -387,7 +387,7 @@ class OnceDownloadRow extends React.Component {
onSuccess={this.handleEditSuccess}
onDelete={this.handleDelete}
/>
</ModalContent>
</Modal.Content>
</Modal>
);
} else if (downloader === Downloaders.Archive) {
@ -397,8 +397,8 @@ class OnceDownloadRow extends React.Component {
open={this.state.editModalOpen}
onClose={this.handleEditClose}
>
<ModalHeader>Edit Archive Download</ModalHeader>
<ModalContent>
<Modal.Header>Edit Archive Download</Modal.Header>
<Modal.Content>
<EditArchiveDownloadForm
download={{
urls: url,
@ -409,7 +409,7 @@ class OnceDownloadRow extends React.Component {
onSuccess={this.handleEditSuccess}
onDelete={this.handleDelete}
/>
</ModalContent>
</Modal.Content>
</Modal>
);
}

View file

@ -5,14 +5,9 @@ import {
Button,
Divider,
Form,
FormField,
FormGroup,
FormInput,
Header,
Loader,
Modal,
ModalContent,
ModalHeader,
Segment
} from "../Theme";
import {ButtonGroup, Container, Dimmer, Dropdown, GridColumn, GridRow, Icon, Input} from "semantic-ui-react";
@ -409,8 +404,8 @@ export function SettingsPage() {
/>
</div>
<FormGroup inline>
<FormInput
<Form.Group inline>
<Form.Input
label={<>
<b>Download Timeout</b>
<InfoPopup content='Downloads will be stopped after this many seconds have elapsed.
@ -420,28 +415,28 @@ export function SettingsPage() {
disabled={disabled || state.download_timeout === null}
onChange={(e, i) => handleTimeoutChange(e, 'download_timeout', i.value)}
/>
</FormGroup>
</Form.Group>
<FormGroup inline>
<FormInput
<Form.Group inline>
<Form.Input
label='Hotspot SSID'
value={state.hotspot_ssid}
disabled={disabled || state.hotspot_ssid === null}
onChange={(e, i) => setState({...state, hotspot_ssid: i.value})}
/>
<FormInput
<Form.Input
label='Hotspot Password'
disabled={disabled || state.hotspot_password === null}
value={state.hotspot_password}
onChange={(e, i) => setState({...state, hotspot_password: i.value})}
/>
<FormInput
<Form.Input
label='Hotspot Device'
disabled={disabled || state.hotspot_password === null}
value={state.hotspot_device}
onChange={(e, i) => handleInputChange(e, 'hotspot_device', i.value)}
/>
</FormGroup>
</Form.Group>
<Modal closeIcon
onClose={() => setQrOpen(false)}
@ -449,14 +444,14 @@ export function SettingsPage() {
open={qrOpen}
trigger={qrButton}
>
<ModalHeader>
<Modal.Header>
Scan this code to join the hotspot
</ModalHeader>
<ModalContent>
</Modal.Header>
<Modal.Content>
<div style={{display: 'inline-block', backgroundColor: '#ffffff', padding: '1em'}}>
<QRCode value={qrCodeValue} size={300}/>
</div>
</ModalContent>
</Modal.Content>
</Modal>
<br/>
@ -503,7 +498,7 @@ export function SettingsPage() {
<Grid stackable>
<GridRow columns={2}>
<GridColumn>
<FormField>
<Form.Field>
<label>Archive Directory</label>
<Input
label={mediaDirectoryLabel}
@ -511,10 +506,10 @@ export function SettingsPage() {
disabled={!editSpecialDirectories}
onChange={(e, d) => handleInputChange(e, 'archive_destination', d.value)}
/>
</FormField>
</Form.Field>
</GridColumn>
<GridColumn>
<FormField>
<Form.Field>
<label>Videos Directory</label>
<Input
label={mediaDirectoryLabel}
@ -522,12 +517,12 @@ export function SettingsPage() {
disabled={!editSpecialDirectories}
onChange={(e, d) => handleInputChange(e, 'videos_destination', d.value)}
/>
</FormField>
</Form.Field>
</GridColumn>
</GridRow>
<GridRow columns={2}>
<GridColumn>
<FormField>
<Form.Field>
<label>Map Directory</label>
<Input
label={mediaDirectoryLabel}
@ -535,10 +530,10 @@ export function SettingsPage() {
disabled={!editSpecialDirectories}
onChange={(e, d) => handleInputChange(e, 'map_destination', d.value)}
/>
</FormField>
</Form.Field>
</GridColumn>
<GridColumn>
<FormField>
<Form.Field>
<label>Zims Directory</label>
<Input
label={mediaDirectoryLabel}
@ -546,7 +541,7 @@ export function SettingsPage() {
disabled={!editSpecialDirectories}
onChange={(e, d) => handleInputChange(e, 'zims_destination', d.value)}
/>
</FormField>
</Form.Field>
</GridColumn>
</GridRow>
<GridRow columns={1}>

View file

@ -1,4 +1,4 @@
import {Accordion, Header, Progress, Segment, Statistic, StatisticGroup, Table} from "../Theme";
import {Accordion, Header, Progress, Segment, Statistic, Table} from "../Theme";
import React, {useContext} from "react";
import {humanBandwidth, humanFileSize, InfoHeader, LoadStatistic, useTitle} from "../Common";
import {ProgressPlaceholder} from "../Placeholder";
@ -248,7 +248,7 @@ export function StatusPage() {
<Segment>
{cpuProgress}
{memoryUsageProgress}
<StatisticGroup>
<Statistic.Group>
<CPUTemperatureStatistic
id='cpu_temperature_statistic'
temperature={temperature}
@ -258,14 +258,14 @@ export function StatusPage() {
<LoadStatistic label='1 Minute Load' value={minute_1} cores={cores}/>
<LoadStatistic label='5 Minute Load' value={minute_5} cores={cores}/>
<LoadStatistic label='15 Minute Load' value={minute_15} cores={cores}/>
</StatisticGroup>
</Statistic.Group>
</Segment>
</Media>
<Media greaterThanOrEqual='tablet'>
<Segment>
{cpuProgress}
{memoryUsageProgress}
<StatisticGroup size='mini'>
<Statistic.Group size='mini'>
<CPUTemperatureStatistic
id='cpu_temperature_statistic'
temperature={temperature}
@ -276,7 +276,7 @@ export function StatusPage() {
<LoadStatistic label='1 Min. Load' value={minute_1} cores={cores}/>
<LoadStatistic label='5 Min.' value={minute_5} cores={cores}/>
<LoadStatistic label='15 Min.' value={minute_15} cores={cores}/>
</StatisticGroup>
</Statistic.Group>
</Segment>
</Media>