Skip to content

Commit

Permalink
feat: add announcement banner (#551)
Browse files Browse the repository at this point in the history
* fix: can't delete projects

* fix: add prisma transaction

* fix: notifcation subscription register expired time

* feat: add system maintainance banner

* fix: remove stale dependencies

* docs: add the system-maitenance doc

* feat: add mainteance banner to pages
  • Loading branch information
devrsi0n authored Dec 4, 2022
1 parent a452cbe commit 376a3a0
Show file tree
Hide file tree
Showing 33 changed files with 1,972 additions and 1,972 deletions.
4 changes: 2 additions & 2 deletions apps/comment-bootstrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"@testing-library/react": "13.4.0",
"@types/jest": "29.2.3",
"@types/node": "16.11.45",
"@types/react": "18.0.25",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
"dotenv": "16.0.3",
"dotenv-cli": "6.0.0",
"dotenv-expand": "9.0.0",
"eslint": "8.28.0",
"eslint": "8.29.0",
"jest": "29.3.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dotenv": "16.0.3",
"dotenv-cli": "6.0.0",
"dotenv-expand": "9.0.0",
"eslint": "8.28.0",
"eslint": "8.29.0",
"typescript": "4.9.3"
},
"publishConfig": {
Expand Down
1 change: 0 additions & 1 deletion apps/main/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const nextConfig = {
'@chirpy-dev/emails',
'@chirpy-dev/ui',
'@chirpy-dev/utils',
'@chirpy-dev/graphql',
'@chirpy-dev/types',
'@chirpy-dev/trpc',
],
Expand Down
20 changes: 6 additions & 14 deletions apps/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@
"@tensorflow/tfjs-core": "3.18.0",
"cors": "2.8.5",
"github-slugger": "1.5.0",
"graphql": "16.6.0",
"graphql-tag": "2.12.6",
"graphql-ws": "5.11.2",
"gray-matter": "4.0.3",
"html-loader": "4.2.0",
"jsonwebtoken": "8.5.1",
"lodash": "4.17.21",
"next": "13.0.5",
"next": "13.0.6",
"next-axiom": "0.15.1",
"next-connect": "0.13.0",
"next-mdx-remote": "3.0.8",
Expand All @@ -51,35 +47,31 @@
"rehype-slug": "5.1.0",
"shiki": "0.11.1",
"superjson": "1.11.0",
"type-fest": "3.2.0",
"web-push": "3.5.0",
"wonka": "6.1.1",
"ws": "8.11.0"
"type-fest": "3.3.0",
"web-push": "3.5.0"
},
"devDependencies": {
"@chirpy-dev/comment-bootstrapper": "workspace:*",
"@chirpy-dev/emails": "workspace:*",
"@chirpy-dev/eslint-config": "workspace:*",
"@chirpy-dev/service-worker": "workspace:*",
"@chirpy-dev/tsconfigs": "workspace:*",
"@next/bundle-analyzer": "13.0.5",
"@next/bundle-analyzer": "13.0.6",
"@relative-ci/agent": "4.1.1",
"@types/cors": "2.8.12",
"@types/github-slugger": "1.3.0",
"@types/jest": "29.2.3",
"@types/jsonwebtoken": "8.5.9",
"@types/lodash": "4.14.189",
"@types/node": "16.11.45",
"@types/react": "18.0.25",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
"@types/requestidlecallback": "0.3.5",
"@types/web-push": "3.3.2",
"@types/ws": "8.5.3",
"configs": "workspace:*",
"dotenv": "16.0.3",
"dotenv-cli": "6.0.0",
"dotenv-expand": "9.0.0",
"eslint": "8.28.0",
"eslint": "8.29.0",
"jest": "29.3.1",
"postcss": "8.4.19",
"tailwindcss": "3.2.4",
Expand Down
3 changes: 2 additions & 1 deletion apps/main/posts/docs/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"features/anti-toxic-comment.mdx",
"features/moderate.mdx",
"API/webhook.mdx",
"self-hosted.mdx"
"self-hosted.mdx",
"system-maintenance.mdx"
]
}
23 changes: 23 additions & 0 deletions apps/main/posts/docs/system-maintenance.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: 'System maintenance'
---

# System maintenance

We show a fixed banner to our widgets and pages during a system maintenance, we try our best to keep the downtime as short as possible, but sometimes it is necessary to perform maintenance on the system to improve the performance and unblock new features.

## What you can't do in maintenance mode

You can't post a new comment, delete a comment (as the site owner) or like a comment.

You can't create a new project, delete a project or customize the widget theme.

You can't make comment widget work on your new pages.

## What you can do in maintenance mode

You can still read the comments, you existing session should be unaffected, so you can still see your projects, themes or analytics.

You can also read the docs and blogs.

Thank you for your support!
8 changes: 0 additions & 8 deletions apps/main/src/server/utilities/token.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/service-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dotenv": "16.0.3",
"dotenv-cli": "6.0.0",
"dotenv-expand": "9.0.0",
"eslint": "8.28.0",
"eslint": "8.29.0",
"typescript": "4.9.3",
"vite": "2.9.14"
},
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"@changesets/cli": "2.25.2",
"@chirpy-dev/eslint-config": "workspace:*",
"@chirpy-dev/prettier-config": "workspace:*",
"eslint": "8.28.0",
"eslint": "8.29.0",
"husky": "8.0.2",
"lint-staged": "13.0.4",
"next": "13.0.5",
"next": "13.0.6",
"prettier": "2.8.0",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand All @@ -42,15 +42,11 @@
"allowedVersions": {
"react": "18",
"react-dom": "18",
"graphql": "16",
"glob": "8",
"core-js": "3",
"@tensorflow/tfjs-core": "3",
"@tensorflow/tfjs-converter": "3"
}
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
},
"prettier": "@chirpy-dev/prettier-config",
Expand Down
2 changes: 1 addition & 1 deletion packages/docker-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@types/node": "16.11.45",
"@types/web-push": "3.3.2",
"@types/which": "2.0.1",
"@types/yargs": "17.0.13",
"@types/yargs": "17.0.15",
"dotenv": "16.0.3",
"eta": "1.12.3",
"ts-node": "10.9.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
"main": "./index.js",
"dependencies": {
"@chirpy-dev/prettier-config": "workspace:*",
"@typescript-eslint/eslint-plugin": "5.44.0",
"@typescript-eslint/parser": "5.44.0",
"eslint-config-next": "13.0.5",
"@typescript-eslint/eslint-plugin": "5.45.0",
"@typescript-eslint/parser": "5.45.0",
"eslint-config-next": "13.0.6",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "27.1.6",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-storybook": "0.6.7",
"eslint-plugin-unicorn": "45.0.1",
"next": "13.0.5",
"next": "13.0.6",
"prettier": "2.8.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.3"
},
"devDependencies": {
"eslint": "8.28.0"
"eslint": "8.29.0"
},
"publishConfig": {
"access": "public"
Expand Down
16 changes: 8 additions & 8 deletions packages/trpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"@chirpy-dev/types": "workspace:*",
"@chirpy-dev/utils": "workspace:*",
"@next-auth/prisma-adapter": "1.0.5",
"@prisma/client": "4.6.1",
"@tanstack/react-query": "4.18.0",
"@trpc/client": "10.4.1",
"@trpc/next": "10.4.1",
"@trpc/react-query": "10.4.1",
"@trpc/server": "10.4.1",
"@prisma/client": "4.7.1",
"@tanstack/react-query": "4.19.1",
"@trpc/client": "10.4.3",
"@trpc/next": "10.4.3",
"@trpc/react-query": "10.4.3",
"@trpc/server": "10.4.3",
"@types/web-push": "3.3.2",
"next": "13.0.5",
"next": "13.0.6",
"next-auth": "4.17.0",
"next-axiom": "0.15.1",
"react": "18.2.0",
Expand All @@ -36,7 +36,7 @@
"devDependencies": {
"@types/jest": "29.2.3",
"@types/node": "16.11.45",
"prisma": "4.6.1",
"prisma": "4.7.1",
"typescript": "4.9.3"
},
"keywords": [],
Expand Down
58 changes: 39 additions & 19 deletions packages/trpc/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -26,9 +25,10 @@ model Account {
session_state String?
oauthTokenSecret String?
oauthToken String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@unique([provider, providerAccountId])
@@index([userId])
}

model Comment {
Expand All @@ -40,11 +40,15 @@ model Comment {
userId String
content Json
deletedAt DateTime?
page Page @relation(fields: [pageId], references: [id], onDelete: Cascade)
page Page @relation(fields: [pageId], references: [id], onDelete: Cascade, onUpdate: Cascade)
parent Comment? @relation("CommentToComment", fields: [parentId], references: [id], onDelete: NoAction, onUpdate: NoAction)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
replies Comment[] @relation("CommentToComment")
likes Like[]
@@index([pageId])
@@index([parentId])
@@index([userId])
}

model Like {
Expand All @@ -53,10 +57,11 @@ model Like {
updatedAt DateTime @updatedAt
commentId String
userId String
comment Comment @relation(fields: [commentId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
comment Comment @relation(fields: [commentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@unique([commentId, userId])
@@index([userId])
}

model Member {
Expand All @@ -66,11 +71,13 @@ model Member {
teamId String
userId String
role String
Role Role @relation(fields: [role], references: [value], onDelete: Cascade)
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
Role Role @relation(fields: [role], references: [value], onDelete: Cascade, onUpdate: Cascade)
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade, onUpdate: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@unique([teamId, userId])
@@index([role])
@@index([userId])
}

model NotificationMessage {
Expand All @@ -85,22 +92,26 @@ model NotificationMessage {
// TODO: Replace it with commentId & likeId
contextId String
content String? @db.Text
recipient User @relation("NotificationMessage_recipientIdToUser", fields: [recipientId], references: [id], onDelete: Cascade)
triggeredBy User @relation("NotificationMessage_triggeredByIdToUser", fields: [triggeredById], references: [id], onDelete: Cascade)
NotificationType NotificationType @relation(fields: [type], references: [value], onDelete: Cascade)
recipient User @relation("NotificationMessage_recipientIdToUser", fields: [recipientId], references: [id], onDelete: Cascade, onUpdate: Cascade)
triggeredBy User @relation("NotificationMessage_triggeredByIdToUser", fields: [triggeredById], references: [id], onDelete: Cascade, onUpdate: Cascade)
NotificationType NotificationType @relation(fields: [type], references: [value], onDelete: Cascade, onUpdate: Cascade)
@@unique([type, triggeredById, contextId, recipientId])
@@index([recipientId])
@@index([triggeredById])
}

model NotificationSubscription {
id String @id @default(cuid())
userId String
subscription Json
createdAt DateTime? @default(now())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
// Check uniqueness muanually because mysql doesn't allow it
// @@unique([subscription, userId])
@@index([userId])
}

model NotificationType {
Expand All @@ -116,8 +127,10 @@ model Page {
url String @unique(length: 191) @db.Text
title String? @db.Text
projectId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade, onUpdate: Cascade)
comments Comment[]
@@index([projectId])
}

model Project {
Expand All @@ -129,9 +142,12 @@ model Project {
userId String?
theme Json?
domain String @unique
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade, onUpdate: Cascade)
user User? @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
pages Page[]
@@index([teamId])
@@index([userId])
}

model Role {
Expand All @@ -147,7 +163,9 @@ model Session {
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
@@index([userId])
}

model Team {
Expand All @@ -173,7 +191,7 @@ model User {
bio String?
website String?
twitterUserName String?
userType UserType? @relation(fields: [type], references: [value], onDelete: Cascade)
userType UserType? @relation(fields: [type], references: [value], onDelete: Cascade, onUpdate: Cascade)
accounts Account[]
comments Comment[]
likes Like[]
Expand All @@ -183,6 +201,8 @@ model User {
notificationSubscriptions NotificationSubscription[]
projects Project[]
sessions Session[]
@@index([type])
}

model UserType {
Expand Down
Loading

0 comments on commit 376a3a0

Please sign in to comment.