chore: migrate eslint and prettier to biome and fix all linting errors
This commit is contained in:
parent
82413a8212
commit
9bcf233d2c
22 changed files with 397 additions and 481 deletions
|
@ -6,6 +6,7 @@ import { type ChartData } from "chart.js";
|
|||
import { LineChart, WordCloudChart } from "~/components/ui/charts";
|
||||
|
||||
import { dmPartnerRecipientQuery, dmSentMessagesPerPersonOverviewQuery, SELF_ID, threadMostUsedWordsQuery } from "~/db";
|
||||
import { getNameFromRecipient } from "~/lib/getNameFromRecipient";
|
||||
|
||||
export const DmId: Component<RouteSectionProps> = (props) => {
|
||||
const dmId = () => Number(props.params.dmid);
|
||||
|
@ -17,10 +18,11 @@ export const DmId: Component<RouteSectionProps> = (props) => {
|
|||
if (dmPartner) {
|
||||
return {
|
||||
id: dmPartner._id,
|
||||
name: /* can be empty string */ !dmPartner.system_joined_name
|
||||
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
dmPartner.profile_joined_name!
|
||||
: dmPartner.system_joined_name,
|
||||
name: getNameFromRecipient(
|
||||
dmPartner.nickname_joined_name,
|
||||
dmPartner.system_joined_name,
|
||||
dmPartner.profile_joined_name,
|
||||
),
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,6 +3,8 @@ import type { RouteSectionProps } from "@solidjs/router";
|
|||
|
||||
export const GroupId: Component<RouteSectionProps> = (props) => {
|
||||
const groupId = () => Number(props.params.groupid);
|
||||
|
||||
return groupId();
|
||||
};
|
||||
|
||||
export default GroupId;
|
||||
|
|
|
@ -23,11 +23,7 @@ export const Home: Component<RouteSectionProps> = () => {
|
|||
|
||||
return (
|
||||
<div>
|
||||
<input
|
||||
type="file"
|
||||
accept=".sqlite"
|
||||
onChange={onFileChange}
|
||||
></input>
|
||||
<input type="file" accept=".sqlite" onChange={onFileChange}></input>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ import type { RouteSectionProps } from "@solidjs/router";
|
|||
import { allThreadsOverviewQuery, overallSentMessagesQuery, SELF_ID } from "~/db";
|
||||
|
||||
import { OverviewTable, type RoomOverview } from "./overview-table";
|
||||
import { getNameFromRecipient } from "~/lib/getNameFromRecipient";
|
||||
|
||||
export const Overview: Component<RouteSectionProps> = () => {
|
||||
const [allSelfSentMessagesCount] = createResource(() => overallSentMessagesQuery(SELF_ID));
|
||||
|
@ -12,14 +13,13 @@ export const Overview: Component<RouteSectionProps> = () => {
|
|||
return (await allThreadsOverviewQuery()).rows.map((row) => {
|
||||
const isGroup = row.title !== null;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const name = (
|
||||
isGroup
|
||||
? row.title
|
||||
: /* seems possible that it is an empty string */ !row.system_joined_name
|
||||
? row.profile_joined_name
|
||||
: row.system_joined_name
|
||||
)!;
|
||||
let name = "";
|
||||
|
||||
if (row.title !== null) {
|
||||
name = row.title;
|
||||
} else {
|
||||
name = getNameFromRecipient(row.nickname_joined_name, row.system_joined_name, row.profile_joined_name);
|
||||
}
|
||||
|
||||
return {
|
||||
threadId: row.thread_id,
|
||||
|
@ -36,12 +36,8 @@ export const Overview: Component<RouteSectionProps> = () => {
|
|||
return (
|
||||
<div>
|
||||
<p>All messages: {allSelfSentMessagesCount()?.messageCount as number}</p>
|
||||
<Show
|
||||
when={!roomOverview.loading}
|
||||
fallback="Loading..."
|
||||
>
|
||||
{/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */}
|
||||
<OverviewTable data={roomOverview()!} />;
|
||||
<Show when={!roomOverview.loading && roomOverview()} fallback="Loading...">
|
||||
{(currentRoomOverview) => <OverviewTable data={currentRoomOverview()} />}
|
||||
</Show>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -76,11 +76,7 @@ export const columns = [
|
|||
}}
|
||||
>
|
||||
Name
|
||||
<SortingDisplay
|
||||
sorting={sorting()}
|
||||
class="ml-2 h-4 w-4"
|
||||
activeClass="text-info-foreground"
|
||||
/>
|
||||
<SortingDisplay sorting={sorting()} class="ml-2 h-4 w-4" activeClass="text-info-foreground" />
|
||||
</Button>
|
||||
);
|
||||
},
|
||||
|
@ -94,18 +90,12 @@ export const columns = [
|
|||
<Show when={isArchived || isGroup}>
|
||||
<div class="ml-auto flex flex-row gap-2">
|
||||
<Show when={isArchived}>
|
||||
<Badge
|
||||
variant="outline"
|
||||
class="ml-auto"
|
||||
>
|
||||
<Badge variant="outline" class="ml-auto">
|
||||
Archived
|
||||
</Badge>
|
||||
</Show>
|
||||
<Show when={isGroup}>
|
||||
<Badge
|
||||
variant="outline"
|
||||
class="ml-auto"
|
||||
>
|
||||
<Badge variant="outline" class="ml-auto">
|
||||
Group
|
||||
</Badge>
|
||||
</Show>
|
||||
|
@ -128,11 +118,7 @@ export const columns = [
|
|||
}}
|
||||
>
|
||||
Number of messages
|
||||
<SortingDisplay
|
||||
sorting={sorting()}
|
||||
class="ml-2 h-4 w-4"
|
||||
activeClass="text-info-foreground"
|
||||
/>
|
||||
<SortingDisplay sorting={sorting()} class="ml-2 h-4 w-4" activeClass="text-info-foreground" />
|
||||
</Button>
|
||||
);
|
||||
},
|
||||
|
@ -150,11 +136,7 @@ export const columns = [
|
|||
}}
|
||||
>
|
||||
Date of last message
|
||||
<SortingDisplay
|
||||
sorting={sorting()}
|
||||
class="ml-2 h-4 w-4"
|
||||
activeClass="text-info-foreground"
|
||||
/>
|
||||
<SortingDisplay sorting={sorting()} class="ml-2 h-4 w-4" activeClass="text-info-foreground" />
|
||||
</Button>
|
||||
);
|
||||
},
|
||||
|
@ -252,10 +234,7 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
value={(table.getColumn("name")?.getFilterValue() as string | undefined) ?? ""}
|
||||
onChange={(value) => table.getColumn("name")?.setFilterValue(value)}
|
||||
>
|
||||
<TextFieldInput
|
||||
placeholder="Filter by name..."
|
||||
class="max-w-sm"
|
||||
/>
|
||||
<TextFieldInput placeholder="Filter by name..." class="max-w-sm" />
|
||||
</TextField>
|
||||
</div>
|
||||
<div class="flex items-start space-x-2">
|
||||
|
@ -277,7 +256,7 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
<For each={headerGroup.headers}>
|
||||
{(header) => (
|
||||
<TableHead
|
||||
class="border-b border-r border-t first-of-type:rounded-tl-md first-of-type:border-l last-of-type:rounded-tr-md"
|
||||
class="border-t border-r border-b first-of-type:rounded-tl-md first-of-type:border-l last-of-type:rounded-tr-md"
|
||||
colSpan={header.colSpan}
|
||||
>
|
||||
<Show when={!header.isPlaceholder}>
|
||||
|
@ -297,7 +276,7 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
<TableRow>
|
||||
<TableCell
|
||||
colSpan={columns.length}
|
||||
class="h-24 border-b border-r text-center first-of-type:rounded-tl-md first-of-type:border-l last-of-type:rounded-br-md"
|
||||
class="h-24 border-r border-b text-center first-of-type:rounded-tl-md first-of-type:border-l last-of-type:rounded-br-md"
|
||||
>
|
||||
No results.
|
||||
</TableCell>
|
||||
|
@ -318,7 +297,7 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
>
|
||||
<For each={row.getVisibleCells()}>
|
||||
{(cell) => (
|
||||
<TableCell class="border-b border-r first-of-type:border-l">
|
||||
<TableCell class="border-r border-b first-of-type:border-l">
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</TableCell>
|
||||
)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue