From bcbf5ce3bc30e53ed05308c72b3315f57456c168 Mon Sep 17 00:00:00 2001 From: Igor Bubelov Date: Wed, 13 Mar 2024 19:51:14 +0700 Subject: [PATCH 1/2] Add help links --- src/components/IssueCell.svelte | 9 +++++++++ src/components/IssuesTable.svelte | 21 ++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/components/IssueCell.svelte b/src/components/IssueCell.svelte index 4e06e42..fc03c2f 100644 --- a/src/components/IssueCell.svelte +++ b/src/components/IssueCell.svelte @@ -29,4 +29,13 @@ > Edit +{:else if id === 'helpLink' && value} + + How to fix? + {/if} diff --git a/src/components/IssuesTable.svelte b/src/components/IssuesTable.svelte index 82fdfad..e29475a 100644 --- a/src/components/IssuesTable.svelte +++ b/src/components/IssuesTable.svelte @@ -34,6 +34,7 @@ type: string; viewLink: string; editLink: string; + helpLink: string | undefined; }; let table: Readable> | undefined; @@ -75,7 +76,18 @@ const viewLink = id[0] + '/' + id[1]; const editLink = id[0] + '=' + id[1]; - return { icon, name, type, viewLink, editLink }; + let helpLink: string | undefined; + + switch (issue.description) { + case 'Out of date': + case 'Not verified': + helpLink = 'https://wiki.btcmap.org/general/outdated'; + break; + default: + helpLink = undefined; + } + + return { icon, name, type, viewLink, editLink, helpLink }; }); const columns: ColumnDef[] = [ @@ -100,6 +112,13 @@ cell: (info) => flexRender(IssueCell, { id: 'type', value: info.getValue() }), enableGlobalFilter: false }, + { + accessorKey: 'helpLink', + header: '', + cell: (info) => flexRender(IssueCell, { id: 'helpLink', value: info.getValue() }), + enableSorting: false, + enableGlobalFilter: false + }, { accessorKey: 'viewLink', header: '', From 7ea6412967ddc6f6301005c9072418ca526cf988 Mon Sep 17 00:00:00 2001 From: secondl1ght Date: Thu, 14 Mar 2024 21:50:06 -0600 Subject: [PATCH 2/2] refactor and add to other issues view --- src/components/IssueCell.svelte | 4 ++-- src/components/IssueIcon.svelte | 2 +- src/components/IssuesTable.svelte | 26 ++++++++------------------ src/components/TaggingIssues.svelte | 12 +++++++++++- src/lib/utils.ts | 16 ++++++++++++++++ 5 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/components/IssueCell.svelte b/src/components/IssueCell.svelte index fc03c2f..d63ef51 100644 --- a/src/components/IssueCell.svelte +++ b/src/components/IssueCell.svelte @@ -1,7 +1,7 @@ @@ -36,6 +36,6 @@ rel="noreferrer" class="text-link transition-colors hover:text-hover" > - How to fix? + Help {/if} diff --git a/src/components/IssueIcon.svelte b/src/components/IssueIcon.svelte index 4091ccd..b04db21 100644 --- a/src/components/IssueIcon.svelte +++ b/src/components/IssueIcon.svelte @@ -4,7 +4,7 @@ export let icon: IssueIcon | string; -
+
{#if icon === 'fa-calendar-days'} flexRender(IssueCell, { id: 'helpLink', value: info.getValue() }), + cell: (info) => flexRender(IssueCell, { id: 'viewLink', value: info.getValue() }), enableSorting: false, enableGlobalFilter: false }, { - accessorKey: 'viewLink', + accessorKey: 'editLink', header: '', - cell: (info) => flexRender(IssueCell, { id: 'viewLink', value: info.getValue() }), + cell: (info) => flexRender(IssueCell, { id: 'editLink', value: info.getValue() }), enableSorting: false, enableGlobalFilter: false }, { - accessorKey: 'editLink', + accessorKey: 'helpLink', header: '', - cell: (info) => flexRender(IssueCell, { id: 'editLink', value: info.getValue() }), + cell: (info) => flexRender(IssueCell, { id: 'helpLink', value: info.getValue() }), enableSorting: false, enableGlobalFilter: false } diff --git a/src/components/TaggingIssues.svelte b/src/components/TaggingIssues.svelte index ee740ce..d382f22 100644 --- a/src/components/TaggingIssues.svelte +++ b/src/components/TaggingIssues.svelte @@ -1,7 +1,7 @@

{issue.description}

+ {#if getIssueHelpLink(issue.type)} + + Help + + {/if}
{/each} {:else} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 8af56f5..4f756b6 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -131,6 +131,22 @@ export const getIssueIcon = (type: IssueType): IssueIcon => { } }; +export const getIssueHelpLink = (type: IssueType) => { + switch (type) { + case 'out_of_date': + case 'out_of_date_soon': + case 'not_verified': + return 'https://wiki.btcmap.org/general/outdated'; + case 'date_format': + return 'https://wiki.btcmap.org/general/tagging-instructions#verified-tags---more-information'; + case 'misspelled_tag': + return 'https://wiki.btcmap.org/general/tagging-instructions#required-tags'; + case 'missing_icon': + default: + return undefined; + } +}; + export const isEven = (number: number) => { return number % 2 === 0; };