diff --git a/app/components/layout/marketing.tsx b/app/components/layout/marketing.tsx index 7885914c..529454a1 100644 --- a/app/components/layout/marketing.tsx +++ b/app/components/layout/marketing.tsx @@ -27,6 +27,12 @@ const MarketingLogoLink = createContainerComponent({ displayName: 'MarketingLogoLink', }) +const MarketingLogoImage = createContainerComponent({ + defaultTagName: 'img', + defaultClassName: 'h-52 w-52 rounded-full object-cover', + displayName: 'MarketingLogoImage', +}) + const MarketingHeader = createContainerComponent({ defaultTagName: 'h1', defaultClassName: @@ -72,6 +78,7 @@ export { MarketingContentSection, MarketingDetailsSection, MarketingLogoLink, + MarketingLogoImage, MarketingHeader, MarketingContent, MarketingSocialLinksList, diff --git a/app/components/layout/page-footer.tsx b/app/components/layout/page-footer.tsx index 0cb3d45f..0338b834 100644 --- a/app/components/layout/page-footer.tsx +++ b/app/components/layout/page-footer.tsx @@ -1,11 +1,14 @@ +import { useOptionalUser } from '#app/utils/user' import Logo from '../logo' import { ThemeSwitch } from '../theme-switch' const PageFooter = () => { + const user = useOptionalUser() + return (
- + {user ? : '🔺'}
) } diff --git a/app/components/layout/page-header.tsx b/app/components/layout/page-header.tsx index ed07791e..24fa3f85 100644 --- a/app/components/layout/page-header.tsx +++ b/app/components/layout/page-header.tsx @@ -1,6 +1,7 @@ import { Link } from '@remix-run/react' import { useOptionalUser } from '#app/utils/user' import Logo from '../logo' +import { ThemeSwitch } from '../theme-switch' import { Button } from '../ui/button' import { UserDropdown } from '../user-dropdown' @@ -12,13 +13,7 @@ const PageHeader = () => { diff --git a/app/models/user/user.get.server.ts b/app/models/user/user.get.server.ts index 4959ee40..71a38f40 100644 --- a/app/models/user/user.get.server.ts +++ b/app/models/user/user.get.server.ts @@ -1,6 +1,6 @@ import { z } from 'zod' import { prisma } from '#app/utils/db.server' -import { type IUser, type IUserBasic } from './user.server' +import { type IUserBasic } from './user.server' export type queryWhereArgsType = z.infer const queryWhereArgs = z.object({ @@ -33,24 +33,3 @@ export const getUserBasic = async ({ image, } } - -export const getFirstUser = async (): Promise | null> => { - return await prisma.user.findFirst({ - select: { - name: true, - username: true, - bio: true, - sm_url_instagram: true, - sm_url_github: true, - createdAt: true, - }, - }) -} diff --git a/app/routes/_marketing+/components/content.tsx b/app/routes/_marketing+/components/content.tsx index 9a9be8e2..e08dfaf2 100644 --- a/app/routes/_marketing+/components/content.tsx +++ b/app/routes/_marketing+/components/content.tsx @@ -1,31 +1,10 @@ import { MarketingContent, MarketingHeader, - MarketingLogoLink, MarketingSocialLinksList, } from '#app/components/layout/marketing' import { Icon } from '#app/components/ui/icon' -export const ContentLogo = () => { - return ( - - - - - - - - ) -} - export const ContentHeader = () => { return ( diff --git a/app/routes/_marketing+/index.tsx b/app/routes/_marketing+/index.tsx index e6969a56..a964ce3b 100644 --- a/app/routes/_marketing+/index.tsx +++ b/app/routes/_marketing+/index.tsx @@ -8,19 +8,30 @@ import { useLoaderData } from '@remix-run/react' import { MarketingContentSection, MarketingDetailsSection, + MarketingLogoImage, + MarketingLogoLink, MarketingMainLayout, } from '#app/components/layout/marketing.tsx' -import { getFirstUser } from '#app/models/user/user.get.server.ts' +import { prisma } from '#app/utils/db.server.ts' +import { getUserImgSrc } from '#app/utils/misc.tsx' import { ContentBody, ContentContact, ContentHeader, - ContentLogo, } from './components/content.tsx' import { ImagesGrid } from './components/images-grid.tsx' export async function loader({ params, request }: LoaderFunctionArgs) { - const user = await getFirstUser() + const user = await await prisma.user.findFirst({ + select: { + name: true, + username: true, + bio: true, + sm_url_instagram: true, + sm_url_github: true, + image: { select: { id: true } }, + }, + }) invariantResponse(user, 'Nothing to show today', { status: 404 }) return json({ @@ -31,13 +42,21 @@ export async function loader({ params, request }: LoaderFunctionArgs) { export default function Index() { const data = useLoaderData() const { user } = data - console.log(user) return ( - + + + diff --git a/app/routes/settings+/profile.index.tsx b/app/routes/settings+/profile.index.tsx index 52e73134..9c060f27 100644 --- a/app/routes/settings+/profile.index.tsx +++ b/app/routes/settings+/profile.index.tsx @@ -30,7 +30,7 @@ export const handle: SEOHandle = { const ProfileFormSchema = z.object({ name: NameSchema.optional(), username: UsernameSchema, - bio: z.string().max(500).optional(), + bio: z.string().max(1000).optional(), sm_url_instagram: z.string().optional(), sm_url_github: z.string().optional(), })