-
-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract notifications into new package
- Loading branch information
1 parent
196fbe6
commit 7fadfa6
Showing
10 changed files
with
748 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
packages/design-system/components/knock-notification-feed.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use client'; | ||
|
||
import { | ||
NotificationFeedPopover, | ||
NotificationIconButton, | ||
} from '@knocklabs/react'; | ||
import { useRef, useState } from 'react'; | ||
|
||
// Required CSS import, unless you're overriding the styling | ||
import '@knocklabs/react/dist/index.css'; | ||
|
||
export const KnockNotificationFeed = () => { | ||
const [isVisible, setIsVisible] = useState(false); | ||
const notifButtonRef = useRef(null); | ||
|
||
return ( | ||
<> | ||
<NotificationIconButton | ||
ref={notifButtonRef} | ||
onClick={() => setIsVisible(!isVisible)} | ||
/> | ||
<NotificationFeedPopover | ||
buttonRef={notifButtonRef} | ||
isVisible={isVisible} | ||
onClose={() => setIsVisible(false)} | ||
/> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Knock } from '@knocklabs/node'; | ||
import { keys } from './keys'; | ||
|
||
const key = keys().KNOCK_SECRET_API_KEY; | ||
|
||
export const notifications = new Knock(key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { createEnv } from '@t3-oss/env-nextjs'; | ||
import { z } from 'zod'; | ||
|
||
export const keys = () => | ||
createEnv({ | ||
server: { | ||
KNOCK_API_KEY: z.string().min(1).optional(), | ||
KNOCK_FEED_CHANNEL_ID: z.string().min(1).optional(), | ||
KNOCK_SECRET_API_KEY: z.string().min(1).optional(), | ||
}, | ||
runtimeEnv: { | ||
KNOCK_API_KEY: process.env.KNOCK_API_KEY, | ||
KNOCK_FEED_CHANNEL_ID: process.env.KNOCK_FEED_CHANNEL_ID, | ||
KNOCK_SECRET_API_KEY: process.env.KNOCK_SECRET_API_KEY, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "@repo/notifications", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"clean": "git clean -xdf .cache .turbo dist node_modules", | ||
"typecheck": "tsc --noEmit --emitDeclarationOnly false" | ||
}, | ||
"dependencies": { | ||
"@knocklabs/node": "^0.6.13", | ||
"@knocklabs/react": "^0.2.29", | ||
"@t3-oss/env-nextjs": "^0.11.1", | ||
"react": "^19.0.0", | ||
"zod": "^3.24.1" | ||
}, | ||
"devDependencies": { | ||
"@repo/typescript-config": "workspace:*", | ||
"typescript": "^5.7.2", | ||
"@types/node": "22.10.5", | ||
"@types/react": "19.0.2", | ||
"@types/react-dom": "^19.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "@repo/typescript-config/nextjs.json", | ||
"compilerOptions": { | ||
"baseUrl": "." | ||
}, | ||
"include": ["**/*.ts", "**/*.tsx"], | ||
"exclude": ["node_modules"] | ||
} |
Oops, something went wrong.