Skip to content

Commit 8567111

Browse files
authored
Dev (#13)
1 parent bf3648b commit 8567111

9 files changed

Lines changed: 80 additions & 59 deletions

File tree

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### 🐛 Bug Fixes
66

7+
- Subscriber growth graph bug fixed
8+
- Creating a subscriber with metadata now works
79
- Various bug fixes and optimizations.
810

911
### 📚 Docs

apps/backend/prisma/client/sql/subscriberGrowthQuery.edge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"use strict";
44
const { makeTypedQueryFactory: $mkFactory } = require("../runtime/edge.js");
55
exports.subscriberGrowthQuery = /*#__PURE__*/ $mkFactory(
6-
'SELECT\nDATE_TRUNC(\'week\', "createdAt") as date,\nCOUNT(*) as count\nFROM "public"."Subscriber"\nWHERE "organizationId" = $1\nAND "createdAt" >= $2\nAND "createdAt" <= $3\nGROUP BY DATE_TRUNC(\'week\', "createdAt")\nORDER BY date ASC',
6+
'SELECT\nDATE_TRUNC(\'day\', "createdAt") as date,\nCOUNT(*) as count\nFROM "public"."Subscriber"\nWHERE "organizationId" = $1\nAND "createdAt" >= $2\nAND "createdAt" <= $3\nGROUP BY DATE_TRUNC(\'day\', "createdAt")\nORDER BY date ASC',
77
);

apps/backend/prisma/client/sql/subscriberGrowthQuery.edge.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
/* eslint-disable */
33
import { makeTypedQueryFactory as $mkFactory } from "../runtime/edge.js";
44
export const subscriberGrowthQuery = /*#__PURE__*/ $mkFactory(
5-
'SELECT\nDATE_TRUNC(\'week\', "createdAt") as date,\nCOUNT(*) as count\nFROM "public"."Subscriber"\nWHERE "organizationId" = $1\nAND "createdAt" >= $2\nAND "createdAt" <= $3\nGROUP BY DATE_TRUNC(\'week\', "createdAt")\nORDER BY date ASC',
5+
'SELECT\nDATE_TRUNC(\'day\', "createdAt") as date,\nCOUNT(*) as count\nFROM "public"."Subscriber"\nWHERE "organizationId" = $1\nAND "createdAt" >= $2\nAND "createdAt" <= $3\nGROUP BY DATE_TRUNC(\'day\', "createdAt")\nORDER BY date ASC',
66
);

apps/backend/prisma/client/sql/subscriberGrowthQuery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"use strict";
44
const { makeTypedQueryFactory: $mkFactory } = require("../runtime/library");
55
exports.subscriberGrowthQuery = /*#__PURE__*/ $mkFactory(
6-
'SELECT\nDATE_TRUNC(\'week\', "createdAt") as date,\nCOUNT(*) as count\nFROM "public"."Subscriber"\nWHERE "organizationId" = $1\nAND "createdAt" >= $2\nAND "createdAt" <= $3\nGROUP BY DATE_TRUNC(\'week\', "createdAt")\nORDER BY date ASC',
6+
'SELECT\nDATE_TRUNC(\'day\', "createdAt") as date,\nCOUNT(*) as count\nFROM "public"."Subscriber"\nWHERE "organizationId" = $1\nAND "createdAt" >= $2\nAND "createdAt" <= $3\nGROUP BY DATE_TRUNC(\'day\', "createdAt")\nORDER BY date ASC',
77
);

apps/backend/prisma/client/sql/subscriberGrowthQuery.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
/* eslint-disable */
33
import { makeTypedQueryFactory as $mkFactory } from "../runtime/library";
44
export const subscriberGrowthQuery = /*#__PURE__*/ $mkFactory(
5-
'SELECT\nDATE_TRUNC(\'week\', "createdAt") as date,\nCOUNT(*) as count\nFROM "public"."Subscriber"\nWHERE "organizationId" = $1\nAND "createdAt" >= $2\nAND "createdAt" <= $3\nGROUP BY DATE_TRUNC(\'week\', "createdAt")\nORDER BY date ASC',
5+
'SELECT\nDATE_TRUNC(\'day\', "createdAt") as date,\nCOUNT(*) as count\nFROM "public"."Subscriber"\nWHERE "organizationId" = $1\nAND "createdAt" >= $2\nAND "createdAt" <= $3\nGROUP BY DATE_TRUNC(\'day\', "createdAt")\nORDER BY date ASC',
66
);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
SELECT
2-
DATE_TRUNC('week', "createdAt") as date,
2+
DATE_TRUNC('day', "createdAt") as date,
33
COUNT(*) as count
44
FROM "public"."Subscriber"
55
WHERE "organizationId" = $1
66
AND "createdAt" >= $2
77
AND "createdAt" <= $3
8-
GROUP BY DATE_TRUNC('week', "createdAt")
8+
GROUP BY DATE_TRUNC('day', "createdAt")
99
ORDER BY date ASC

apps/docs/src/app/layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ export const metadata: Metadata = {
6363

6464
const navbar = (
6565
<Navbar
66-
// logo={<b>LetterSpace</b>}
6766
logo={
68-
<Link className="flex items-center gap-2" href="/">
67+
<Link className="flex items-center gap-2" href="https://letterspace.app">
6968
<Image
7069
src="/android-chrome-192x192.png"
7170
alt="LetterSpace"

apps/web/src/pages/dashboard/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use client"
2-
31
import {
42
Mail,
53
ArrowRight,
@@ -255,7 +253,7 @@ export function DashboardPage() {
255253
<CardTitle>Subscriber Growth</CardTitle>
256254
<CardDescription>
257255
New subscribers over time{" "}
258-
<span className="text-xs text-muted-foreground">(Weekly)</span>
256+
<span className="text-xs text-muted-foreground">(Daily)</span>
259257
</CardDescription>
260258
</CardHeader>
261259
<CardContent>

apps/web/src/pages/dashboard/subscribers/add-subscriber-dialog.tsx

Lines changed: 70 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function AddSubscriberDialog({
4949
name: "",
5050
listIds: [],
5151
emailVerified: false,
52-
metadata: [{ key: "", value: "" }],
52+
metadata: [],
5353
},
5454
})
5555

@@ -189,55 +189,77 @@ export function AddSubscriberDialog({
189189
)}
190190
/>
191191
<div>
192-
<FormLabel>Metadata</FormLabel>
193-
{metadataFields.map((field, index) => (
194-
<div key={field.id} className="flex items-center gap-2 mt-2">
195-
<FormField
196-
control={form.control}
197-
name={`metadata.${index}.key`}
198-
render={({ field }) => (
199-
<FormItem className="flex-1">
200-
<FormControl>
201-
<Input placeholder="Key" {...field} />
202-
</FormControl>
203-
<FormMessage />
204-
</FormItem>
205-
)}
206-
/>
207-
<FormField
208-
control={form.control}
209-
name={`metadata.${index}.value`}
210-
render={({ field }) => (
211-
<FormItem className="flex-1">
212-
<FormControl>
213-
<Input placeholder="Value" {...field} />
214-
</FormControl>
215-
<FormMessage />
216-
</FormItem>
217-
)}
218-
/>
219-
{metadataFields.length > 1 && (
220-
<Button
221-
type="button"
222-
variant="ghost"
223-
size="icon"
224-
onClick={() => removeMetadata(index)}
192+
<FormLabel className="text-base">Metadata</FormLabel>
193+
{metadataFields.length > 0 ? (
194+
<>
195+
{metadataFields.map((field, index) => (
196+
<div
197+
key={field.id}
198+
className="flex items-center gap-2 mt-2"
225199
>
226-
<Trash2 className="h-4 w-4" />
227-
</Button>
228-
)}
200+
<FormField
201+
control={form.control}
202+
name={`metadata.${index}.key`}
203+
render={({ field: keyField }) => (
204+
<FormItem className="flex-1">
205+
<FormControl>
206+
<Input placeholder="Key" {...keyField} />
207+
</FormControl>
208+
<FormMessage />
209+
</FormItem>
210+
)}
211+
/>
212+
<FormField
213+
control={form.control}
214+
name={`metadata.${index}.value`}
215+
render={({ field: valueField }) => (
216+
<FormItem className="flex-1">
217+
<FormControl>
218+
<Input placeholder="Value" {...valueField} />
219+
</FormControl>
220+
<FormMessage />
221+
</FormItem>
222+
)}
223+
/>
224+
<Button
225+
type="button"
226+
variant="ghost"
227+
size="icon"
228+
onClick={() => removeMetadata(index)}
229+
>
230+
<Trash2 className="h-4 w-4" />
231+
</Button>
232+
</div>
233+
))}
234+
</>
235+
) : (
236+
<div className="flex flex-col mt-2 mb-2 border rounded-md p-4">
237+
<p className="text-sm text-muted-foreground mb-2">
238+
No metadata added yet
239+
</p>
240+
<Button
241+
type="button"
242+
variant="outline"
243+
size="sm"
244+
onClick={() => appendMetadata({ key: "", value: "" })}
245+
>
246+
<Plus className="h-4 w-4 mr-2" />
247+
Add Metadata
248+
</Button>
229249
</div>
230-
))}
231-
<Button
232-
type="button"
233-
variant="outline"
234-
size="sm"
235-
className="mt-2"
236-
onClick={() => appendMetadata({ key: "", value: "" })}
237-
>
238-
<Plus className="h-4 w-4 mr-2" />
239-
Add Metadata
240-
</Button>
250+
)}
251+
{metadataFields.length > 0 && (
252+
<Button
253+
type="button"
254+
variant="outline"
255+
size="sm"
256+
className="mt-2"
257+
onClick={() => appendMetadata({ key: "", value: "" })}
258+
>
259+
<Plus className="h-4 w-4 mr-2" />
260+
Add Metadata
261+
</Button>
262+
)}
241263
</div>
242264
<DialogFooter>
243265
<Button

0 commit comments

Comments
 (0)