Skip to content

Commit 85a2b11

Browse files
author
James O'Claire
committed
Some final keyword cleanup
1 parent 681c1e2 commit 85a2b11

File tree

3 files changed

+36
-88
lines changed

3 files changed

+36
-88
lines changed

backend/dbcon/sql/query_app_keywords_history.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ FROM
99
frontend.app_keyword_ranks_daily
1010
WHERE
1111
store_app = :store_app_id
12-
AND keyword_id = ANY(:keyword_ids)
12+
-- note this may need to change to = ANY() to support psycopg3
13+
AND keyword_id IN :keyword_ids
1314
AND crawled_date >= :start_date
1415
ORDER BY
1516
crawled_date DESC;

frontend/src/lib/components/account/TrackedKeywordsSection.svelte

Lines changed: 24 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script lang="ts">
22
import { enhance } from '$app/forms';
3-
import type { SubmitFunction } from '@sveltejs/kit';
43
import type { AccountFormResult, TrackedKeyword } from './types';
54
65
let {
@@ -10,18 +9,6 @@
109
keywords: TrackedKeyword[];
1110
form?: AccountFormResult;
1211
} = $props();
13-
14-
let editingId = $state<number | null>(null);
15-
16-
const syncFormAndCloseEditor: SubmitFunction = () => {
17-
return async ({ result, update }) => {
18-
await update();
19-
20-
if (result.type === 'success') {
21-
editingId = null;
22-
}
23-
};
24-
};
2512
</script>
2613

2714
<section class="space-y-4">
@@ -49,65 +36,32 @@
4936
{:else}
5037
{#each keywords as keyword (keyword.id)}
5138
<div class="rounded-lg bg-surface-100-900 p-3">
52-
{#if editingId === keyword.id}
53-
<form
54-
method="POST"
55-
action="?/updateTrackedKeyword"
56-
use:enhance={syncFormAndCloseEditor}
57-
class="grid gap-3 md:grid-cols-[1fr_1fr_auto] md:items-center"
58-
>
59-
<input type="hidden" name="id" value={keyword.id} />
60-
<input type="text" name="store_id" class="input" value={keyword.store_id} required />
61-
<input
62-
type="text"
63-
name="keyword_text"
64-
class="input"
65-
value={keyword.keyword_text}
66-
required
67-
/>
68-
<div class="flex gap-2">
69-
<button type="submit" class="btn preset-tonal">Save</button>
70-
<button
71-
type="button"
72-
class="btn preset-outlined"
73-
onclick={() => (editingId = null)}
74-
>
75-
Cancel
76-
</button>
77-
</div>
78-
</form>
79-
{:else}
80-
<div class="flex items-center justify-between gap-3">
81-
<div>
82-
<p class="font-medium">{keyword.keyword_text}</p>
83-
<p class="text-xs text-surface-500">
84-
{#if keyword.app_name}
85-
{keyword.app_name} ({keyword.store_id})
86-
{:else}
39+
<div class="flex items-center justify-between gap-3">
40+
<div>
41+
<p class="font-medium">{keyword.keyword_text}</p>
42+
<p class="text-xs text-surface-500">
43+
{#if keyword.app_name}
44+
<a href={`/apps/${keyword.store_id}/keywords`} class="hover:underline">
45+
{keyword.app_name}
46+
</a>
47+
(
48+
<a href={`/apps/${keyword.store_id}/keywords`} class="hover:underline">
8749
{keyword.store_id}
88-
{/if}
89-
</p>
90-
</div>
91-
92-
<div class="flex gap-2">
93-
<button
94-
type="button"
95-
class="btn preset-outlined"
96-
onclick={() => (editingId = keyword.id)}
97-
>
98-
Edit
99-
</button>
100-
<form
101-
method="POST"
102-
action="?/deleteTrackedKeyword"
103-
use:enhance={syncFormAndCloseEditor}
104-
>
105-
<input type="hidden" name="id" value={keyword.id} />
106-
<button type="submit" class="btn preset-outlined-error-500">Remove</button>
107-
</form>
108-
</div>
50+
</a>
51+
)
52+
{:else}
53+
<a href={`/apps/${keyword.store_id}/keywords`} class="hover:underline">
54+
{keyword.store_id}
55+
</a>
56+
{/if}
57+
</p>
10958
</div>
110-
{/if}
59+
60+
<form method="POST" action="?/deleteTrackedKeyword" use:enhance>
61+
<input type="hidden" name="id" value={keyword.id} />
62+
<button type="submit" class="btn preset-outlined-error-900-100">Remove</button>
63+
</form>
64+
</div>
11165
</div>
11266
{/each}
11367
{/if}

frontend/src/routes/apps/[id]/(sub)/keywords/compare/+page.svelte

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,13 @@
180180
<section class={cardPadding}>
181181
<h1 class="h4 md:h3 mb-1">Keyword Rank Comparison</h1>
182182
<p class={textMuted}>
183-
Compare rank history for <strong>{data.myapp.name}</strong> across multiple keywords. Select up
184-
to 10.
183+
Compare rank history for <strong>{data.myapp.name}</strong> across multiple keywords.
185184
</p>
186185
<p class="mt-2 text-sm text-primary-800-200">
187186
This view helps you measure momentum, spot ranking drops, and evaluate whether tracked terms
188187
are improving after metadata changes.
189188
</p>
190-
<p class="mt-2 text-xs text-primary-800-200">
191-
Mobile tip: start with 3 to 5 keywords for easier chart readability, then add more when
192-
needed.
193-
</p>
189+
<p class="mt-2 text-xs text-primary-800-200">Tip: Add more keywords for comparison.</p>
194190
</section>
195191

196192
<!-- Keyword Picker ───────────────────────────────────────────────────────── -->
@@ -213,7 +209,13 @@
213209
class="h-2.5 w-2.5 rounded-full"
214210
style="background-color: {plotColors[i % plotColors.length]}"
215211
></span>
216-
{kw}
212+
<a
213+
href={`/apps/${data.myapp.store_id}/keywords`}
214+
class="hover:underline"
215+
title="Open app keyword dashboard"
216+
>
217+
{kw}
218+
</a>
217219
<button
218220
type="button"
219221
onclick={() => removeKeyword(kw)}
@@ -227,7 +229,7 @@
227229
</div>
228230

229231
<!-- Search / add picker -->
230-
{#if activeKeywords.length < 10}
232+
{#if activeKeywords.length <= 5}
231233
<div class="relative">
232234
<div class="flex gap-2">
233235
<div class="relative flex-1">
@@ -379,13 +381,4 @@
379381
<p class={textMuted}>Use the picker above to add keywords to compare.</p>
380382
</section>
381383
{/if}
382-
383-
<!-- Shareable URL tip -->
384-
{#if activeKeywords.length > 0}
385-
<section class={cardPadding}>
386-
<p class="text-xs text-primary-800-200">
387-
📎 This comparison is shareable — the URL updates as you add/remove keywords.
388-
</p>
389-
</section>
390-
{/if}
391384
</div>

0 commit comments

Comments
 (0)