Skip to content

Commit bb10a47

Browse files
author
Luca Forstner
committed
ref: Refactor changelog list page
1 parent dcf71f3 commit bb10a47

File tree

12 files changed

+7139
-173
lines changed

12 files changed

+7139
-173
lines changed

apps/changelog/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
# warning: variables prefixed with NEXT_PUBLIC_ will be made available to client-side code
44
# be careful not to expose sensitive data
55

6-
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/changelog
6+
DATABASE_URL=postgres://postgres:BSd1sa244r5CI7S@localhost/changelog?host=34.70.239.3
77
NEXTAUTH_URL=http://localhost:3000
88
NEXTAUTH_SECRET=secret

apps/changelog/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"next-auth": "^4.24.5",
2828
"next-mdx-remote": "^4.4.1",
2929
"nextjs-toploader": "^1.6.6",
30+
"nuqs": "^1.17.7",
3031
"prism-sentry": "^1.0.2",
3132
"react": "beta",
3233
"react-dom": "beta",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- Made the column `publishedAt` on table `Changelog` required. This step will fail if there are existing NULL values in that column.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "Changelog" ALTER COLUMN "publishedAt" SET NOT NULL;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Please do not edit this file manually
2+
# It should be added in your version-control system (i.e. Git)
3+
provider = "postgresql"

apps/changelog/prisma/schema.prisma

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ generator client {
55

66
datasource db {
77
provider = "postgresql"
8-
url = env("DATABASE_URL")
8+
url = "postgres://postgres:BSd1sa244r5CI7S@localhost/changelog?host=34.70.239.3"
99
}
1010

1111
model Account {
@@ -58,7 +58,7 @@ model VerificationToken {
5858
model Changelog {
5959
id String @id @default(cuid())
6060
createdAt DateTime @default(now())
61-
publishedAt DateTime? @default(now())
61+
publishedAt DateTime @default(now())
6262
updatedAt DateTime @updatedAt
6363
title String @db.VarChar(255)
6464
slug String @unique @db.VarChar(255)

apps/changelog/src/app/changelog/%5Fadmin/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ export default async function ChangelogsListPage() {
103103
<span className="text-gray-500">
104104
<Text size="1">
105105
{' '}
106-
{new Date(changelog.publishedAt || '').toLocaleDateString(
107-
undefined,
108-
{month: 'long', day: 'numeric'}
109-
)}
106+
{new Date(changelog.publishedAt || '').toLocaleDateString('en-EN', {
107+
month: 'long',
108+
day: 'numeric',
109+
timeZone: 'UTC',
110+
})}
110111
</Text>
111112
<br />
112113
</span>

apps/changelog/src/client/components/article.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {ReactNode} from 'react';
2-
import Tag from './tag';
3-
import { DateComponent } from './date';
2+
import {DateComponent} from './date';
3+
import {CategoryTag} from './tag';
44

55
type ArticleProps = {
66
children?: ReactNode;
@@ -41,7 +41,7 @@ export default function Article({
4141
<h3 className="text-3xl text-primary font-semibold mb-2">{title}</h3>
4242
<div>
4343
<div className="flex flex-wrap gap-1 py-1">
44-
{Array.isArray(tags) && tags.map(tag => <Tag key={tag} text={tag} />)}
44+
{Array.isArray(tags) && tags.map(tag => <CategoryTag key={tag} text={tag} />)}
4545
</div>
4646

4747
<div className="prose max-w-none text-gray-700 py-2">{children}</div>

apps/changelog/src/client/components/date.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
const formatDate = (date: string | Date) => {
2-
const options: Intl.DateTimeFormatOptions = {
2+
const now = new Date(date).toLocaleDateString('en-EN', {
33
year: 'numeric',
44
month: 'long',
55
day: 'numeric',
66
timeZone: 'UTC'
7-
};
8-
const now = new Date(date).toLocaleDateString('en-EN', options);
7+
});
98

109
return now;
1110
};

0 commit comments

Comments
 (0)