Skip to content

Commit 3e6967d

Browse files
committed
chore: cleanup
1 parent b17e681 commit 3e6967d

File tree

4 files changed

+45
-38
lines changed

4 files changed

+45
-38
lines changed

src/components/PostEmbed.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ export const PostEmbed = ({ embed }: { embed?: BSkyPostEmbed | null }) => {
6060
<a href={embed.external.uri} target="_blank" rel="noreferrer" className="hover:underline">
6161
{embed.external.title}
6262
</a>
63-
<Image
64-
type="post"
65-
src={embed.external.uri ?? embed.external.thumb}
66-
alt={embed.external.title}
67-
classNames={{
68-
image: 'rounded-lg w-full aspect-square object-cover',
69-
}}
70-
/>
63+
{!!embed.external.thumb && (
64+
<Image
65+
type="post"
66+
src={embed.external.thumb}
67+
alt={embed.external.title}
68+
classNames={{
69+
image: 'rounded-lg w-full aspect-square object-cover',
70+
}}
71+
/>
72+
)}
7173
</div>
7274
);
7375
case 'app.bsky.embed.record#view': {

src/components/ui/Image.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ export const Image = ({ src, alt, type, classNames, ...props }: ImageProps) => {
3333

3434
if (!src) {
3535
return (
36-
<div className="bg-neutral-200 dark:bg-neutral-600 text-black dark:text-white text-center aspect-square justify-center items-center flex">
36+
<div
37+
className={cn(
38+
'bg-neutral-200 dark:bg-neutral-600 text-black dark:text-white text-center aspect-square justify-center items-center flex',
39+
classNames?.image,
40+
)}
41+
>
3742
<span>{t('noImage')}</span>
3843
</div>
3944
);

src/routeTree.gen.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { createFileRoute } from '@tanstack/react-router'
1313
// Import Routes
1414

1515
import { Route as rootRoute } from './routes/__root'
16-
import { Route as NotificationsImport } from './routes/notifications'
1716
import { Route as MessagesIndexImport } from './routes/messages/index'
1817
import { Route as MessagesConvoIdImport } from './routes/messages/$convoId'
1918
import { Route as ProfileHandleIndexImport } from './routes/profile/$handle/index'
@@ -22,6 +21,7 @@ import { Route as ProfileHandlePostPostIdImport } from './routes/profile/$handle
2221
// Create Virtual Routes
2322

2423
const SettingsLazyImport = createFileRoute('/settings')()
24+
const NotificationsLazyImport = createFileRoute('/notifications')()
2525
const LoginLazyImport = createFileRoute('/login')()
2626
const IndexLazyImport = createFileRoute('/')()
2727
const TagTagLazyImport = createFileRoute('/tag/$tag')()
@@ -34,18 +34,18 @@ const SettingsLazyRoute = SettingsLazyImport.update({
3434
getParentRoute: () => rootRoute,
3535
} as any).lazy(() => import('./routes/settings.lazy').then((d) => d.Route))
3636

37+
const NotificationsLazyRoute = NotificationsLazyImport.update({
38+
id: '/notifications',
39+
path: '/notifications',
40+
getParentRoute: () => rootRoute,
41+
} as any).lazy(() => import('./routes/notifications.lazy').then((d) => d.Route))
42+
3743
const LoginLazyRoute = LoginLazyImport.update({
3844
id: '/login',
3945
path: '/login',
4046
getParentRoute: () => rootRoute,
4147
} as any).lazy(() => import('./routes/login.lazy').then((d) => d.Route))
4248

43-
const NotificationsRoute = NotificationsImport.update({
44-
id: '/notifications',
45-
path: '/notifications',
46-
getParentRoute: () => rootRoute,
47-
} as any)
48-
4949
const IndexLazyRoute = IndexLazyImport.update({
5050
id: '/',
5151
path: '/',
@@ -93,20 +93,20 @@ declare module '@tanstack/react-router' {
9393
preLoaderRoute: typeof IndexLazyImport
9494
parentRoute: typeof rootRoute
9595
}
96-
'/notifications': {
97-
id: '/notifications'
98-
path: '/notifications'
99-
fullPath: '/notifications'
100-
preLoaderRoute: typeof NotificationsImport
101-
parentRoute: typeof rootRoute
102-
}
10396
'/login': {
10497
id: '/login'
10598
path: '/login'
10699
fullPath: '/login'
107100
preLoaderRoute: typeof LoginLazyImport
108101
parentRoute: typeof rootRoute
109102
}
103+
'/notifications': {
104+
id: '/notifications'
105+
path: '/notifications'
106+
fullPath: '/notifications'
107+
preLoaderRoute: typeof NotificationsLazyImport
108+
parentRoute: typeof rootRoute
109+
}
110110
'/settings': {
111111
id: '/settings'
112112
path: '/settings'
@@ -156,8 +156,8 @@ declare module '@tanstack/react-router' {
156156

157157
export interface FileRoutesByFullPath {
158158
'/': typeof IndexLazyRoute
159-
'/notifications': typeof NotificationsRoute
160159
'/login': typeof LoginLazyRoute
160+
'/notifications': typeof NotificationsLazyRoute
161161
'/settings': typeof SettingsLazyRoute
162162
'/messages/$convoId': typeof MessagesConvoIdRoute
163163
'/tag/$tag': typeof TagTagLazyRoute
@@ -168,8 +168,8 @@ export interface FileRoutesByFullPath {
168168

169169
export interface FileRoutesByTo {
170170
'/': typeof IndexLazyRoute
171-
'/notifications': typeof NotificationsRoute
172171
'/login': typeof LoginLazyRoute
172+
'/notifications': typeof NotificationsLazyRoute
173173
'/settings': typeof SettingsLazyRoute
174174
'/messages/$convoId': typeof MessagesConvoIdRoute
175175
'/tag/$tag': typeof TagTagLazyRoute
@@ -181,8 +181,8 @@ export interface FileRoutesByTo {
181181
export interface FileRoutesById {
182182
__root__: typeof rootRoute
183183
'/': typeof IndexLazyRoute
184-
'/notifications': typeof NotificationsRoute
185184
'/login': typeof LoginLazyRoute
185+
'/notifications': typeof NotificationsLazyRoute
186186
'/settings': typeof SettingsLazyRoute
187187
'/messages/$convoId': typeof MessagesConvoIdRoute
188188
'/tag/$tag': typeof TagTagLazyRoute
@@ -195,8 +195,8 @@ export interface FileRouteTypes {
195195
fileRoutesByFullPath: FileRoutesByFullPath
196196
fullPaths:
197197
| '/'
198-
| '/notifications'
199198
| '/login'
199+
| '/notifications'
200200
| '/settings'
201201
| '/messages/$convoId'
202202
| '/tag/$tag'
@@ -206,8 +206,8 @@ export interface FileRouteTypes {
206206
fileRoutesByTo: FileRoutesByTo
207207
to:
208208
| '/'
209-
| '/notifications'
210209
| '/login'
210+
| '/notifications'
211211
| '/settings'
212212
| '/messages/$convoId'
213213
| '/tag/$tag'
@@ -217,8 +217,8 @@ export interface FileRouteTypes {
217217
id:
218218
| '__root__'
219219
| '/'
220-
| '/notifications'
221220
| '/login'
221+
| '/notifications'
222222
| '/settings'
223223
| '/messages/$convoId'
224224
| '/tag/$tag'
@@ -230,8 +230,8 @@ export interface FileRouteTypes {
230230

231231
export interface RootRouteChildren {
232232
IndexLazyRoute: typeof IndexLazyRoute
233-
NotificationsRoute: typeof NotificationsRoute
234233
LoginLazyRoute: typeof LoginLazyRoute
234+
NotificationsLazyRoute: typeof NotificationsLazyRoute
235235
SettingsLazyRoute: typeof SettingsLazyRoute
236236
MessagesConvoIdRoute: typeof MessagesConvoIdRoute
237237
TagTagLazyRoute: typeof TagTagLazyRoute
@@ -242,8 +242,8 @@ export interface RootRouteChildren {
242242

243243
const rootRouteChildren: RootRouteChildren = {
244244
IndexLazyRoute: IndexLazyRoute,
245-
NotificationsRoute: NotificationsRoute,
246245
LoginLazyRoute: LoginLazyRoute,
246+
NotificationsLazyRoute: NotificationsLazyRoute,
247247
SettingsLazyRoute: SettingsLazyRoute,
248248
MessagesConvoIdRoute: MessagesConvoIdRoute,
249249
TagTagLazyRoute: TagTagLazyRoute,
@@ -263,8 +263,8 @@ export const routeTree = rootRoute
263263
"filePath": "__root.tsx",
264264
"children": [
265265
"/",
266-
"/notifications",
267266
"/login",
267+
"/notifications",
268268
"/settings",
269269
"/messages/$convoId",
270270
"/tag/$tag",
@@ -276,12 +276,12 @@ export const routeTree = rootRoute
276276
"/": {
277277
"filePath": "index.lazy.tsx"
278278
},
279-
"/notifications": {
280-
"filePath": "notifications.tsx"
281-
},
282279
"/login": {
283280
"filePath": "login.lazy.tsx"
284281
},
282+
"/notifications": {
283+
"filePath": "notifications.lazy.tsx"
284+
},
285285
"/settings": {
286286
"filePath": "settings.lazy.tsx"
287287
},

src/routes/notifications.tsx renamed to src/routes/notifications.lazy.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Ariakit from '@ariakit/react';
2-
import { createFileRoute } from '@tanstack/react-router';
2+
import { createLazyFileRoute } from '@tanstack/react-router';
33
import { useTranslation } from 'react-i18next';
44
import { useNotifications } from '../lib/bluesky/hooks/useNotifications';
55
import { Debug } from '../components/ui/Debug';
@@ -13,7 +13,7 @@ import { Handle } from '../components/ui/Handle';
1313
import { Virtuoso } from 'react-virtuoso';
1414
import { Button } from '../components/ui/Button';
1515

16-
export const Route = createFileRoute('/notifications')({
16+
export const Route = createLazyFileRoute('/notifications')({
1717
component: RouteComponent,
1818
});
1919

@@ -83,7 +83,7 @@ function RouteComponent() {
8383

8484
// group notifications by uri
8585
function GroupedNotifications() {
86-
const { t } = useTranslation('notifications');
86+
const { t } = useTranslation(['app', 'notifications']);
8787
const { data, isLoading, fetchNextPage, isFetching } = useNotifications();
8888
const notifications = data?.pages.flatMap((page) => page.notifications);
8989
if (!notifications) return null;

0 commit comments

Comments
 (0)