Skip to content

Commit 1a4207c

Browse files
committed
improve type and import
1 parent b9815b8 commit 1a4207c

File tree

8 files changed

+10
-13
lines changed

8 files changed

+10
-13
lines changed

components/home/main-header.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import cn from 'clsx';
22
import { Button } from '@components/ui/button';
33
import { HeroIcon } from '@components/ui/hero-icon';
44
import { ToolTip } from '@components/ui/tooltip';
5-
import { MobileSidebar } from '../sidebar/mobile-sidebar';
5+
import { MobileSidebar } from '@components/sidebar/mobile-sidebar';
66
import type { ReactNode } from 'react';
77
import type { IconName } from '@components/ui/hero-icon';
88

components/input/image-preview.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ const variants: MotionProps = {
3030
transition: { type: 'spring', duration: 0.5 }
3131
};
3232

33-
type PostImageBorderRadius = {
34-
[key: number]: string[];
35-
};
33+
type PostImageBorderRadius = Record<number, string[]>;
3634

37-
const postImageBorderRadius: PostImageBorderRadius = {
35+
const postImageBorderRadius: Readonly<PostImageBorderRadius> = {
3836
1: ['rounded-2xl'],
3937
2: ['rounded-tl-2xl rounded-bl-2xl', 'rounded-tr-2xl rounded-br-2xl'],
4038
3: ['rounded-tl-2xl rounded-bl-2xl', 'rounded-tr-2xl', 'rounded-br-2xl'],
@@ -130,7 +128,6 @@ export function ImagePreview({
130128
className='relative h-full w-full cursor-pointer transition
131129
hover:brightness-75 hover:duration-200'
132130
imgClassName={cn(
133-
// '![border-style:solid] !border !border-light-line-reply dark:!border-dark-border',
134131
isTweet
135132
? postImageBorderRadius[previewCount][index]
136133
: 'rounded-2xl'

components/layout/common-layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useRequireAuth } from '@lib/hooks/useRequireAuth';
22
import { Aside } from '@components/aside/aside';
33
import { AsideTrends } from '@components/aside/aside-trends';
44
import { Suggestions } from '@components/aside/suggestions';
5-
import { Placeholder } from '../common/placeholder';
5+
import { Placeholder } from '@components/common/placeholder';
66
import type { ReactNode } from 'react';
77

88
export type LayoutProps = {

components/modal/display-modal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ type DisplayModalProps = {
99
closeModal: () => void;
1010
};
1111

12-
const themes: [Theme, string][] = [
12+
const themes: Readonly<[Theme, string][]> = [
1313
['light', 'Default'],
1414
['dim', 'Dim'],
1515
['dark', 'Lights out']
1616
];
1717

18-
const accentsColor: Accent[] = [
18+
const accentsColor: Readonly<Accent[]> = [
1919
'blue',
2020
'yellow',
2121
'pink',

components/sidebar/sidebar-link.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useRouter } from 'next/router';
22
import Link from 'next/link';
33
import cn from 'clsx';
44
import { preventBubbling } from '@lib/utils';
5-
import { HeroIcon } from '../ui/hero-icon';
5+
import { HeroIcon } from '@components/ui/hero-icon';
66
import type { NavLink } from './sidebar';
77

88
type SidebarLinkProps = NavLink & {

components/user/user-avatar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Link from 'next/link';
22
import cn from 'clsx';
3-
import { NextImage } from '../ui/next-image';
3+
import { NextImage } from '@components/ui/next-image';
44

55
type UserAvatarProps = {
66
src: string;

functions/src/notify-email.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const notifyEmail = regionalFunctions.firestore
3030
parent ? ' reply' : ''
3131
} from ${name} (@${username})`;
3232

33-
const emailText = `${text || 'No text provided'}${
33+
const emailText = `${text ?? 'No text provided'}${
3434
images ? ` (${imagesLength} image${imagesLength > 1 ? 's' : ''})` : ''
3535
}\n\nLink to Tweet: ${tweetLink}\n\n- Firebase Function.`;
3636

functions/src/types/tweet.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type ImagesPreview = (ImageData & {
1313
})[];
1414

1515
export type Tweet = {
16-
text: string;
16+
text: string | null;
1717
images: ImagesPreview | null;
1818
parent: { id: string; username: string } | null;
1919
userLikes: string[];

0 commit comments

Comments
 (0)