Skip to content

Commit bca9512

Browse files
author
James O'Claire
committed
Add paywall for crossfilter
1 parent 3589a67 commit bca9512

File tree

4 files changed

+266
-46
lines changed

4 files changed

+266
-46
lines changed

frontend/src/lib/NavTabs.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
</p>
4747
</a>
4848
<div class={myDivider}></div>
49+
<a href="/app-explorer">
50+
<p class={isHighlighted('/app-explorer') ? topBarHighlightedFont : topBarFont}>
51+
APP EXPLORER
52+
</p>
53+
</a>
54+
<div class={myDivider}></div>
4955
<a href="/blog">
5056
<p class={isHighlighted('/blog') ? topBarHighlightedFont : topBarFont}>BLOG</p>
5157
</a>

frontend/src/routes/+layout.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@
111111
<div class="mb-2">
112112
<a href="/about" class="underline hover:text-primary-900-100">About AppGoblin</a>
113113
&nbsp;|&nbsp;
114+
<a href="/blog" class="underline hover:text-primary-900-100">Blog</a>
115+
&nbsp;|&nbsp;
116+
<a href="/reports" class="underline hover:text-primary-900-100">Reports</a>
117+
&nbsp;|&nbsp;
114118
<a href="/pricing" class="underline hover:text-primary-900-100">Pricing</a>
115119
&nbsp;|&nbsp;
116120
<a href="/privacy_policy.html" class="underline hover:text-primary-900-100"

frontend/src/routes/apps/top/+page.server.ts renamed to frontend/src/routes/app-explorer/+page.server.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
import type { PageServerLoad } from './$types';
22
import { createApiClient } from '$lib/server/api';
3+
import { db } from '$lib/server/auth/db';
34

45
interface CompanyRaw {
56
company_name: string | null;
67
company_domain: string | null;
78
total_apps: number;
89
}
910

10-
export const load: PageServerLoad = async ({ fetch }) => {
11+
export const load: PageServerLoad = async ({ fetch, locals }) => {
12+
const user = locals.user;
13+
let hasPaidAccess = false;
14+
15+
if (user) {
16+
const row = await db.queryOne<{ status: string }>(
17+
`SELECT status FROM subscriptions
18+
WHERE user_id = $1 AND status IN ('active', 'trialing')
19+
ORDER BY created_at DESC LIMIT 1`,
20+
[user.id]
21+
);
22+
hasPaidAccess = !!row;
23+
}
24+
1125
const api = createApiClient(fetch);
1226

1327
// Load companies for the dropdown filters
@@ -30,7 +44,8 @@ export const load: PageServerLoad = async ({ fetch }) => {
3044

3145
return {
3246
companies,
33-
categories
47+
categories,
48+
hasPaidAccess
3449
};
3550
};
3651

0 commit comments

Comments
 (0)