Connect, collaborate, and grow with a community of TypeScript developers
chore: remove default exports from non entry points (#601)
bautistaaa1f2d575908cc
diff --git a/apps/admin/src/app/_components/TabView.tsx b/apps/admin/src/app/_components/TabView.tsxindex 689c85d5..a1c1a36e 100644--- a/apps/admin/src/app/_components/TabView.tsx+++ b/apps/admin/src/app/_components/TabView.tsx@@ -7,7 +7,7 @@ import type { InfiniteReports } from '../report/[id]/_components/report/report.aimport type { BannedUsers, UploadedImages } from './admin.actions';import { ChallengeReviews } from './challenge-reviews';import { ImageUploadReport } from './images';-import Reports from './reports';+import { Reports } from './reports';import { ManageTracks } from './tracks';import { BannedUsers as BannedUserComponent } from './users';diff --git a/apps/admin/src/app/_components/reports.tsx b/apps/admin/src/app/_components/reports.tsxindex e09eca42..91117aff 100644--- a/apps/admin/src/app/_components/reports.tsx+++ b/apps/admin/src/app/_components/reports.tsx@@ -20,7 +20,7 @@ export interface ReportsProps {initialReports: InfiniteReports;}-export default function Reports2({ initialReports }: ReportsProps) {+export function Reports({ initialReports }: ReportsProps) {const router = useRouter();const [page, setPage] = React.useState(0);diff --git a/apps/admin/src/app/report/[id]/_components/report/challenge.report.tsx b/apps/admin/src/app/report/[id]/_components/report/challenge.report.tsxindex 27774c11..425ad530 100644--- a/apps/admin/src/app/report/[id]/_components/report/challenge.report.tsx+++ b/apps/admin/src/app/report/[id]/_components/report/challenge.report.tsx@@ -7,7 +7,7 @@ import type { ReportWithInfo } from '../../report.action';export interface ChallengeReportProps {report: NonNullable<ReportWithInfo>;}-export default async function ChallengeReport({ report }: ChallengeReportProps) {+export async function ChallengeReport({ report }: ChallengeReportProps) {if (!report.challenge || !report.challengeId) return null;const challengeInfo = await getChallenge(report.challengeId);return (diff --git a/apps/admin/src/app/report/[id]/_components/report/comment.report.tsx b/apps/admin/src/app/report/[id]/_components/report/comment.report.tsxindex ca1e5dbc..db9a7840 100644--- a/apps/admin/src/app/report/[id]/_components/report/comment.report.tsx+++ b/apps/admin/src/app/report/[id]/_components/report/comment.report.tsx@@ -1,7 +1,7 @@import Link from 'next/link';import type { ReportWithInfo } from '../../report.action';-export default function CommentReport({ report }: { report: NonNullable<ReportWithInfo> }) {+export function CommentReport({ report }: { report: NonNullable<ReportWithInfo> }) {if (report.type !== 'COMMENT' || report.commentId === null || !report.comment) return null;const rootId = report.comment.rootChallengeId ?? report.comment.rootSolutionId ?? -1;diff --git a/apps/admin/src/app/report/[id]/_components/report/solution.report.tsx b/apps/admin/src/app/report/[id]/_components/report/solution.report.tsxindex cec199ca..61c5d8f6 100644--- a/apps/admin/src/app/report/[id]/_components/report/solution.report.tsx+++ b/apps/admin/src/app/report/[id]/_components/report/solution.report.tsx@@ -13,7 +13,7 @@ async function getSolutionChallenge(challengeId: number) {});}-export default async function SolutionReport({ report }: { report: NonNullable<ReportWithInfo> }) {+export async function SolutionReport({ report }: { report: NonNullable<ReportWithInfo> }) {if (report.type !== 'SOLUTION' || !report.solution) return null;const challenge = await getSolutionChallenge(report.solution.challengeId || -1);diff --git a/apps/admin/src/app/report/[id]/_components/report/user.report.tsx b/apps/admin/src/app/report/[id]/_components/report/user.report.tsxindex 2aafadc7..1650c116 100644--- a/apps/admin/src/app/report/[id]/_components/report/user.report.tsx+++ b/apps/admin/src/app/report/[id]/_components/report/user.report.tsx@@ -8,7 +8,7 @@ interface UserReportProps {report: NonNullable<ReportWithInfo>;}-export default async function UserReportUi({ report }: UserReportProps) {+export async function UserReport({ report }: UserReportProps) {if (!report.userId) return null;const userInfo = await getReportedUserInformation(report.userId);const commentRootId = report.comment?.rootChallengeId ?? report.comment?.rootSolutionId ?? -1;diff --git a/apps/admin/src/app/report/[id]/actions.tsx b/apps/admin/src/app/report/[id]/actions.tsxindex 36133799..b0570cd9 100644--- a/apps/admin/src/app/report/[id]/actions.tsx+++ b/apps/admin/src/app/report/[id]/actions.tsx@@ -34,7 +34,7 @@ export interface ReportActionsBase {user: User;}-export default function ReportActions({ report }: ReportActionsProps) {+export function ReportActions({ report }: ReportActionsProps) {const [banReason, setBanReason] = useState('');const [ban, setBan] = useState(false);const router = useRouter();diff --git a/apps/admin/src/app/report/[id]/page.tsx b/apps/admin/src/app/report/[id]/page.tsxindex c4e2ceb9..e7e1c970 100644--- a/apps/admin/src/app/report/[id]/page.tsx+++ b/apps/admin/src/app/report/[id]/page.tsx@@ -2,11 +2,11 @@ import { Alert, AlertDescription, AlertTitle, Markdown, Text } from '@repo/ui';import { AlertCircle, ChevronLeft } from '@repo/ui/icons';import Link from 'next/link';import { redirect } from 'next/navigation';-import ChallengeReport from './_components/report/challenge.report';-import CommentReport from './_components/report/comment.report';-import SolutionReport from './_components/report/solution.report';-import UserReportUi from './_components/report/user.report';-import ReportActions from './actions';+import { ChallengeReport } from './_components/report/challenge.report';+import { CommentReport } from './_components/report/comment.report';+import { SolutionReport } from './_components/report/solution.report';+import { UserReport } from './_components/report/user.report';+import { ReportActions } from './actions';import { getReport, type ReportWithInfo } from './report.action';export interface Props {@@ -52,7 +52,7 @@ const Report = async function (props: Props) {case 'SOLUTION':return <SolutionReport report={report} />;case 'USER':- return <UserReportUi report={report} />;+ return <UserReport report={report} />;}}diff --git a/apps/admin/src/middlewareNO.ts b/apps/admin/src/middlewareNO.tsdeleted file mode 100644index d5442abc..00000000--- a/apps/admin/src/middlewareNO.ts+++ /dev/null@@ -1,26 +0,0 @@-import { getToken } from 'next-auth/jwt';-import { withAuth } from 'next-auth/middleware';-import { NextResponse } from 'next/server';--export default withAuth(- async function middleware(req) {- const token = await getToken({ req });- const isAuth = Boolean(token);-- if (isAuth) {- return NextResponse.redirect(new URL('/', req.url));- }-- return NextResponse.redirect(new URL('/'));- },- {- callbacks: {- authorized() {- // This is a work-around for handling redirect on auth pages.- // We return true here so that the middleware function above- // is always called.- return true;- },- },- },-);diff --git a/apps/web/src/app/[locale]/_components/community/community.tsx b/apps/web/src/app/[locale]/_components/community/community.tsxindex dcd6ba20..4021b616 100644--- a/apps/web/src/app/[locale]/_components/community/community.tsx+++ b/apps/web/src/app/[locale]/_components/community/community.tsx@@ -9,7 +9,7 @@ import { contributors } from '../../../../../public/contributors';import styles from './community.module.css';import Image from 'next/image';-function Community() {+export function Community() {type WrapperStyle = CSSProperties & {'--bottom': string;};@@ -125,4 +125,3 @@ function Community() {</>);}-export default Community;diff --git a/apps/web/src/app/[locale]/_components/features.tsx b/apps/web/src/app/[locale]/_components/features.tsxindex 4cca2483..1fc72e1a 100644--- a/apps/web/src/app/[locale]/_components/features.tsx+++ b/apps/web/src/app/[locale]/_components/features.tsx@@ -23,7 +23,7 @@ import {CuratedTracksCard,} from './feature-card';-function Features() {+export function Features() {return (<section className="relative overflow-hidden" id="features"><div className="container mb-[64px] grid items-center justify-center">@@ -141,4 +141,3 @@ function Features() {</section>);}-export default Features;diff --git a/apps/web/src/app/[locale]/_components/hero.tsx b/apps/web/src/app/[locale]/_components/hero.tsxindex a439bf83..166051b1 100644--- a/apps/web/src/app/[locale]/_components/hero.tsx+++ b/apps/web/src/app/[locale]/_components/hero.tsx@@ -31,7 +31,7 @@ function TypeHeroLogo() {);}-async function Hero() {+export async function Hero() {const t = await getScopedI18n('landing.hero');return (@@ -113,4 +113,3 @@ async function Hero() {</section>);}-export default Hero;diff --git a/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/index.tsx b/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/index.tsxindex 90cb8664..a97e9862 100644--- a/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/index.tsx+++ b/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/index.tsx@@ -5,8 +5,8 @@ import Link from 'next/link';import { useState } from 'react';import { Button } from '@repo/ui';import { SolutionEditor } from './solution-editor';-import NoSolutions from './nosolutions';-import SubmitSolution from './submit-solution';+import { NoSolutions } from './nosolutions';+import { SubmitSolution } from './submit-solution';import type { ChallengeSolutionsRouteData } from '~/app/[locale]/challenge/[id]/solutions/page';import { getRelativeTime } from '~/utils/relativeTime';diff --git a/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/nosolutions.tsx b/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/nosolutions.tsxindex 8c012017..f52657f0 100644--- a/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/nosolutions.tsx+++ b/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/nosolutions.tsx@@ -1,4 +1,4 @@-import SubmitSolution from './submit-solution';+import { SubmitSolution } from './submit-solution';interface Props {loggedInUser: boolean;@@ -6,7 +6,7 @@ interface Props {setView: (view: 'editor' | 'list') => void;}-function NoSolutions({ setView, loggedInUser, loggedInUserHasSolution }: Props) {+export function NoSolutions({ setView, loggedInUser, loggedInUserHasSolution }: Props) {return (<div className="flex h-full items-center justify-center"><p className="flex flex-col items-center gap-2 text-center text-neutral-500 dark:text-zinc-400">@@ -63,5 +63,3 @@ function NoSolutions({ setView, loggedInUser, loggedInUserHasSolution }: Props)</div>);}--export default NoSolutions;diff --git a/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/submit-solution.tsx b/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/submit-solution.tsxindex 6fcbb051..03d472c5 100644--- a/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/submit-solution.tsx+++ b/apps/web/src/app/[locale]/challenge/[id]/solutions/_components/submit-solution.tsx@@ -6,7 +6,7 @@ interface Props {setView: (view: 'editor' | 'list') => void;}-function SubmitSolution({ disabled, setView }: Props) {+export function SubmitSolution({ disabled, setView }: Props) {return (<ButtonclassName="h-8 rounded-lg bg-emerald-600 px-3 py-2 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300"@@ -17,5 +17,3 @@ function SubmitSolution({ disabled, setView }: Props) {</Button>);}--export default SubmitSolution;diff --git a/apps/web/src/app/[locale]/challenge/_components/comments/delete/index.tsx b/apps/web/src/app/[locale]/challenge/_components/comments/delete/index.tsxindex f5acece1..3078a4ea 100644--- a/apps/web/src/app/[locale]/challenge/_components/comments/delete/index.tsx+++ b/apps/web/src/app/[locale]/challenge/_components/comments/delete/index.tsx@@ -102,5 +102,3 @@ export function CommentDeleteDialog({</Dialog>);}--export default CommentDeleteDialog;diff --git a/apps/web/src/app/[locale]/explore/_components/explore-card.tsx b/apps/web/src/app/[locale]/explore/_components/explore-card.tsxindex c8d49ce0..f408750b 100644--- a/apps/web/src/app/[locale]/explore/_components/explore-card.tsx+++ b/apps/web/src/app/[locale]/explore/_components/explore-card.tsx@@ -111,5 +111,3 @@ export function ExploreCard({ challenge }: ExploreCardProps) {</Card>);}--export default ExploreCard;diff --git a/apps/web/src/app/[locale]/page.tsx b/apps/web/src/app/[locale]/page.tsxindex a6af7d81..f6e106e1 100644--- a/apps/web/src/app/[locale]/page.tsx+++ b/apps/web/src/app/[locale]/page.tsx@@ -1,8 +1,8 @@import type { Metadata } from 'next';import { Footsies } from '~/components/ui/footsies';-import Community from './_components/community/community';-import Features from './_components/features';-import Hero from './_components/hero';+import { Community } from './_components/community/community';+import { Features } from './_components/features';+import { Hero } from './_components/hero';import { WaitlistBanner } from './_components/waitlist-banner';export const metadata: Metadata = {diff --git a/apps/web/src/components/ui/carousel.tsx b/apps/web/src/components/ui/carousel.tsxindex fd01cf7b..dffd5bc4 100644--- a/apps/web/src/components/ui/carousel.tsx+++ b/apps/web/src/components/ui/carousel.tsx@@ -2,7 +2,7 @@import { ChevronLeft, ChevronRight } from '@repo/ui/icons';import clsx from 'clsx';import { useEffect, useRef, useState, type ReactNode, useCallback } from 'react';-import useResizeObserver from '~/utils/useResizeObserver';+import { useResizeObserver } from '~/utils/useResizeObserver';interface Props {children: ReactNode;diff --git a/apps/web/src/components/user/dashboard/index.tsx b/apps/web/src/components/user/dashboard/index.tsxindex 57242c2d..9a10af73 100644--- a/apps/web/src/components/user/dashboard/index.tsx+++ b/apps/web/src/components/user/dashboard/index.tsx@@ -56,7 +56,7 @@ async function getUserdata(id: string) {return userData;}-export default async function Dashboard({ user }: Props) {+export async function Dashboard({ user }: Props) {const userData = await getUserdata(user.id);const session = await getServerAuthSession();diff --git a/apps/web/src/components/user/profile.tsx b/apps/web/src/components/user/profile.tsxindex de0efec2..96dcbda3 100644--- a/apps/web/src/components/user/profile.tsx+++ b/apps/web/src/components/user/profile.tsx@@ -1,7 +1,7 @@import { prisma } from '@repo/db';import type { Metadata } from 'next';import { notFound } from 'next/navigation';-import Dashboard from './dashboard';+import { Dashboard } from './dashboard';interface Props {username: string;diff --git a/apps/web/src/components/wizard/ChallengeCardEditor.tsx b/apps/web/src/components/wizard/ChallengeCardEditor.tsxindex 08800a76..97860371 100644--- a/apps/web/src/components/wizard/ChallengeCardEditor.tsx+++ b/apps/web/src/components/wizard/ChallengeCardEditor.tsx@@ -18,7 +18,7 @@ import {import { useWatch } from 'react-hook-form';import type { WizardForm } from '.';import type { ExploreChallengeData } from '~/app/[locale]/explore/_components/explore.action';-import ExploreCard from '~/app/[locale]/explore/_components/explore-card';+import { ExploreCard } from '~/app/[locale]/explore/_components/explore-card';interface Props {form: WizardForm;diff --git a/apps/web/src/utils/useResizeObserver.ts b/apps/web/src/utils/useResizeObserver.tsindex daef954d..da86c875 100644--- a/apps/web/src/utils/useResizeObserver.ts+++ b/apps/web/src/utils/useResizeObserver.ts@@ -5,10 +5,10 @@ interface Size {height: number;}-const useResizeObserver = (+export function useResizeObserver(ref: React.RefObject<HTMLElement>,callback: (size: Size) => unknown,-) => {+) {const [attached, setAttached] = useState(false);const handleResize = useCallback(@@ -38,6 +38,4 @@ const useResizeObserver = (}, [ref, handleResize]);return attached;-};--export default useResizeObserver;+}