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 { HorizontalSeparator } from '@/Components/Shared/HorizontalSeparator'
const HorizontalLine: FunctionComponent<{ index: number; length: number }> = ({ index, length }) =>
(index < length - 1 ? <HorizontalSeparator classes="my-4" /> : null)
const HorizontalLine: FunctionComponent<{ index: number; length: number }> = ({ index, length }) => {
return index < length - 1 ? <HorizontalSeparator classes="my-4" /> : null
}
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">

View File

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