chore: lint

This commit is contained in:
Mo
2022-05-05 22:33:17 -05:00
parent da7d839fdd
commit cc2b223d0d
3 changed files with 57 additions and 48 deletions

View File

@@ -1,8 +1,9 @@
import { FunctionComponent } from 'preact' import { FunctionComponent } from 'preact'
import { HorizontalSeparator } from '@/Components/Shared/HorizontalSeparator' import { HorizontalSeparator } from '@/Components/Shared/HorizontalSeparator'
const HorizontalLine: FunctionComponent<{ index: number; length: number }> = ({ index, length }) => const HorizontalLine: FunctionComponent<{ index: number; length: number }> = ({ index, length }) => {
(index < length - 1 ? <HorizontalSeparator classes="my-4" /> : null) return index < length - 1 ? <HorizontalSeparator classes="my-4" /> : null
}
export const PreferencesGroup: FunctionComponent = ({ children }) => ( export const PreferencesGroup: FunctionComponent = ({ children }) => (
<div className="bg-default border-1 border-solid rounded border-main px-6 py-6 flex flex-col mb-3"> <div className="bg-default border-1 border-solid rounded border-main px-6 py-6 flex flex-col mb-3">

View File

@@ -53,30 +53,34 @@ export const RemoteHistoryList: FunctionComponent<RemoteHistoryListProps> = obse
ref={remoteHistoryListRef} ref={remoteHistoryListRef}
> >
{isFetchingRemoteHistory && <div className="sk-spinner w-5 h-5 spinner-info"></div>} {isFetchingRemoteHistory && <div className="sk-spinner w-5 h-5 spinner-info"></div>}
{remoteHistory?.map((group) => {remoteHistory?.map((group) => {
(group.entries && group.entries.length ? ( if (group.entries && group.entries.length) {
<Fragment key={group.title}> return (
<div className="px-3 mt-2.5 mb-1 font-semibold color-text uppercase color-grey-0 select-none"> <Fragment key={group.title}>
{group.title} <div className="px-3 mt-2.5 mb-1 font-semibold color-text uppercase color-grey-0 select-none">
</div> {group.title}
{group.entries.map((entry) => ( </div>
<HistoryListItem {group.entries.map((entry) => (
key={entry.uuid} <HistoryListItem
isSelected={selectedEntryUuid === entry.uuid} key={entry.uuid}
onClick={() => { isSelected={selectedEntryUuid === entry.uuid}
setSelectedEntryUuid(entry.uuid) onClick={() => {
fetchAndSetRemoteRevision(entry).catch(console.error) setSelectedEntryUuid(entry.uuid)
}} fetchAndSetRemoteRevision(entry).catch(console.error)
> }}
<div className="flex flex-grow items-center justify-between"> >
<div>{previewHistoryEntryTitle(entry)}</div> <div className="flex flex-grow items-center justify-between">
{!application.features.hasMinimumRole(entry.required_role) && <Icon type="premium-feature" />} <div>{previewHistoryEntryTitle(entry)}</div>
</div> {!application.features.hasMinimumRole(entry.required_role) && <Icon type="premium-feature" />}
</HistoryListItem> </div>
))} </HistoryListItem>
</Fragment> ))}
) : null), </Fragment>
)} )
} else {
return null
}
})}
{!remoteHistoryLength && !isFetchingRemoteHistory && ( {!remoteHistoryLength && !isFetchingRemoteHistory && (
<div className="color-grey-0 select-none">No remote history found</div> <div className="color-grey-0 select-none">No remote history found</div>
)} )}

View File

@@ -53,28 +53,32 @@ export const SessionHistoryList: FunctionComponent<Props> = ({
}`} }`}
ref={sessionHistoryListRef} ref={sessionHistoryListRef}
> >
{sessionHistory?.map((group) => {sessionHistory?.map((group) => {
(group.entries && group.entries.length ? ( if (group.entries && group.entries.length) {
<Fragment key={group.title}> return (
<div className="px-3 mt-2.5 mb-1 font-semibold color-text uppercase color-grey-0 select-none"> <Fragment key={group.title}>
{group.title} <div className="px-3 mt-2.5 mb-1 font-semibold color-text uppercase color-grey-0 select-none">
</div> {group.title}
{group.entries.map((entry, index) => ( </div>
<HistoryListItem {group.entries.map((entry, index) => (
key={index} <HistoryListItem
isSelected={selectedItemCreatedAt === entry.payload.created_at} key={index}
onClick={() => { isSelected={selectedItemCreatedAt === entry.payload.created_at}
setSelectedItemCreatedAt(entry.payload.created_at) onClick={() => {
setSelectedRevision(entry) setSelectedItemCreatedAt(entry.payload.created_at)
setSelectedRemoteEntry(undefined) setSelectedRevision(entry)
}} setSelectedRemoteEntry(undefined)
> }}
{entry.previewTitle()} >
</HistoryListItem> {entry.previewTitle()}
))} </HistoryListItem>
</Fragment> ))}
) : null), </Fragment>
)} )
} else {
return null
}
})}
{!sessionHistoryLength && <div className="color-grey-0 select-none">No session history found</div>} {!sessionHistoryLength && <div className="color-grey-0 select-none">No session history found</div>}
</div> </div>
) )