-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
717 additions
and
64 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
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,43 @@ | ||
'use client'; | ||
|
||
import { UserInformation } from '@/components/common/user-information'; | ||
import { Bottle } from '@/models/bottle'; | ||
import { Asset, FixedBottomCTAButton, spacings } from '@bottlesteam/ui'; | ||
import { useUserAgent } from '@bottlesteam/utils'; | ||
|
||
export function BottleDetail({ bottleDetail: user }: { bottleDetail: Bottle }) { | ||
const userAgent = useUserAgent(); | ||
|
||
const handleInstall = () => { | ||
if (!userAgent.isMobile) { | ||
alert('모바일에서만 설치 가능합니다.'); | ||
return; | ||
} | ||
if (userAgent.isAndroid) { | ||
window.location.href = 'intent://main#Intent;scheme=bottle;package=com.team.bottles;end'; | ||
} | ||
if (userAgent.isIOS) { | ||
// TODO: add iOS scheme | ||
alert('iOS 대응 예정...ㅠ'); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<UserInformation hasCTAButton> | ||
<UserInformation.BasicInformationArea | ||
likeMessage={user.likeMessage} | ||
userImageUrl={user.userImageUrl} | ||
age={user.age} | ||
userName={user.userName} | ||
/> | ||
<UserInformation.IntroductionCard title={`${user.userName}님이 보내는 편지`} introduction={user.introduction} /> | ||
<UserInformation.SelectedProfile profile={user.profileSelect} /> | ||
</UserInformation> | ||
<FixedBottomCTAButton variant="one" onClick={handleInstall}> | ||
<Asset type="icon-letter" style={{ marginRight: spacings.xs }} /> | ||
보틀 설치하고 대화 시작하기 | ||
</FixedBottomCTAButton> | ||
</> | ||
); | ||
} |
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 @@ | ||
'use client'; | ||
|
||
import { Header } from '@bottlesteam/ui'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
export function HeaderArea() { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<Header | ||
onGoBack={() => { | ||
router.back(); | ||
}} | ||
/> | ||
); | ||
} |
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,11 @@ | ||
import { ReactNode } from 'react'; | ||
import { HeaderArea } from './HeaderArea'; | ||
|
||
export default function BottleLayout({ children }: { children: ReactNode }) { | ||
return ( | ||
<> | ||
<HeaderArea /> | ||
{children} | ||
</> | ||
); | ||
} |
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 { Bottle } from '@/models/bottle'; | ||
import { GET, getServerSideTokens, createInit } from '@/server'; | ||
import { UserAgentProvider } from '@bottlesteam/utils'; | ||
import { BottleDetail } from './BottleDetail'; | ||
|
||
export default async function BottlePage({ params: { id } }: { params: { id: number } }) { | ||
const tokens = getServerSideTokens(); | ||
|
||
const bottleDetail = await GET<Bottle>(`/api/v1/bottles/${id}`, tokens, createInit(tokens.accessToken)); | ||
|
||
return ( | ||
<UserAgentProvider> | ||
<BottleDetail bottleDetail={bottleDetail} /> | ||
</UserAgentProvider> | ||
); | ||
} |
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
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
8 changes: 8 additions & 0 deletions
8
apps/demo/src/components/common/overlay-client-patch/index.tsx
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 @@ | ||
'use client'; | ||
|
||
import { OverlayProvider } from 'overlay-kit'; | ||
import { ReactNode } from 'react'; | ||
|
||
export function OverlayClientPatch({ children }: { children: ReactNode }) { | ||
return <OverlayProvider>{children}</OverlayProvider>; | ||
} |
65 changes: 65 additions & 0 deletions
65
apps/demo/src/components/common/selected-profile/index.tsx
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,65 @@ | ||
import { ProfileSelect } from '@/models/profile'; | ||
import { Card, Chip, Paragraph, spacings } from '@bottlesteam/ui'; | ||
import type { ReactNode } from 'react'; | ||
import { chipWrapper, informationContainer, selectedProfileBlockStyle } from './selectedProfileStyle.css'; | ||
|
||
interface Props { | ||
profile: ProfileSelect; | ||
items: ({ | ||
basicInformation, | ||
personalities, | ||
hobbies, | ||
}: { | ||
basicInformation: string[]; | ||
personalities: string[]; | ||
hobbies: string[]; | ||
}) => ReactNode; | ||
} | ||
|
||
export function SelectedProfileImpl({ | ||
profile: { | ||
job, | ||
mbti, | ||
region: { city }, | ||
smoking, | ||
alcohol, | ||
keyword, | ||
height, | ||
interest: { culture, sports, entertainment, etc }, | ||
}, | ||
items, | ||
}: Props) { | ||
const basicInformation = [job, mbti, city, `${height}cm`, smoking, alcohol]; | ||
const personalities = keyword; | ||
const hobbies = [ | ||
...Object.values(culture), | ||
...Object.values(sports), | ||
...Object.values(entertainment), | ||
...Object.values(etc), | ||
]; | ||
|
||
return ( | ||
<Card style={{ marginBottom: spacings.xl }}> | ||
<div className={informationContainer}>{items({ basicInformation, personalities, hobbies })}</div> | ||
</Card> | ||
); | ||
} | ||
|
||
export function SelectedProfileBlock({ type, values }: { type: string; values: (string | number)[] }) { | ||
return ( | ||
<div className={selectedProfileBlockStyle}> | ||
<Paragraph typography="st2" color="neutral600"> | ||
{type} | ||
</Paragraph> | ||
<div className={chipWrapper}> | ||
{values.map(value => ( | ||
<Chip key={value}>{value}</Chip> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export const SelectedProfile = Object.assign(SelectedProfileImpl, { | ||
Item: SelectedProfileBlock, | ||
}); |
21 changes: 21 additions & 0 deletions
21
apps/demo/src/components/common/selected-profile/selectedProfileStyle.css.ts
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,21 @@ | ||
import { spacings } from '@bottlesteam/ui'; | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const selectedProfileBlockStyle = style({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: spacings.sm, | ||
}); | ||
|
||
export const informationContainer = style({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: spacings.xl, | ||
}); | ||
|
||
export const chipWrapper = style({ | ||
display: 'flex', | ||
rowGap: spacings.sm, | ||
columnGap: spacings.xs, | ||
flexWrap: 'wrap', | ||
}); |
31 changes: 31 additions & 0 deletions
31
apps/demo/src/components/common/user-information/BasicInformationArea.tsx
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,31 @@ | ||
import { CurrentUser, OtherUser } from '@/models/user'; | ||
import { Asset, Bubble, Paragraph, spacings } from '@bottlesteam/ui'; | ||
import { Avatar } from '../avatar'; | ||
import { basicInformationAreaStyle, nameAndAgeContainerStyle } from './userInformationStyle.css'; | ||
|
||
type Props = ( | ||
| Pick<CurrentUser, 'imageUrl' | 'age' | 'userName'> | ||
| Pick<OtherUser, 'userImageUrl' | 'age' | 'userName'> | ||
) & { likeMessage?: string }; | ||
|
||
function isCurrentUser(props: Props): props is Pick<CurrentUser, 'imageUrl' | 'age' | 'userName'> { | ||
return 'imageUrl' in props; | ||
} | ||
|
||
export function BasicInformationArea(props: Props) { | ||
return ( | ||
<section className={basicInformationAreaStyle}> | ||
{props.likeMessage && <Bubble style={{ marginBottom: spacings.sm }}>{props.likeMessage}</Bubble>} | ||
<Avatar src={isCurrentUser(props) ? props.imageUrl : props.userImageUrl} size="lg" /> | ||
<div className={nameAndAgeContainerStyle}> | ||
<Paragraph typography="st1" color="neutral900"> | ||
{props.userName} | ||
</Paragraph> | ||
<Asset type="icon-vertical-bar" /> | ||
<Paragraph typography="bo" color="neutral900"> | ||
{props.age}세 | ||
</Paragraph> | ||
</div> | ||
</section> | ||
); | ||
} |
38 changes: 38 additions & 0 deletions
38
apps/demo/src/components/common/user-information/IntroductionCard.tsx
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,38 @@ | ||
import { Introduction } from '@/models/introduction'; | ||
import { User } from '@/models/user'; | ||
import { Card, Paragraph, spacings } from '@bottlesteam/ui'; | ||
import { blockStyle, introductionStyle } from './userInformationStyle.css'; | ||
|
||
interface Props { | ||
introduction: User['introduction']; | ||
title: string; | ||
} | ||
|
||
export function IntroductionCard(props: Props) { | ||
return ( | ||
<Card style={{ marginBottom: spacings.sm }}> | ||
<Paragraph typography="st1" color="black100"> | ||
{props.title} | ||
</Paragraph> | ||
<div className={introductionStyle}> | ||
{props.introduction.length > 0 ? ( | ||
props.introduction.map(field => <IntroductionBlock key={field.question} field={field} />) | ||
) : ( | ||
<Paragraph typography="bo" color="neutral900"> | ||
아직 자기소개를 작성하지 않았아요. | ||
</Paragraph> | ||
)} | ||
</div> | ||
</Card> | ||
); | ||
} | ||
|
||
function IntroductionBlock({ field: { answer } }: { field: Introduction[number] }) { | ||
return ( | ||
<div className={blockStyle}> | ||
<Paragraph typography="bo" color="neutral900"> | ||
{answer} | ||
</Paragraph> | ||
</div> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
apps/demo/src/components/common/user-information/SelectedProfile.tsx
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 @@ | ||
'use client'; | ||
|
||
import { ProfileSelect } from '@/models/profile'; | ||
import { SelectedProfile } from '../selected-profile'; | ||
|
||
interface Props { | ||
profile: ProfileSelect; | ||
} | ||
|
||
export function UserInformationSelectedProfile({ profile }: Props) { | ||
return ( | ||
<SelectedProfile | ||
profile={profile} | ||
items={({ basicInformation, personalities, hobbies }) => ( | ||
<> | ||
<SelectedProfile.Item type="기본 정보" values={basicInformation} /> | ||
<SelectedProfile.Item type="나의 성격은" values={personalities} /> | ||
<SelectedProfile.Item type="내가 푹 빠진 취미는" values={hobbies} /> | ||
</> | ||
)} | ||
/> | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
apps/demo/src/components/common/user-information/index.tsx
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,20 @@ | ||
import type { ReactNode } from 'react'; | ||
import { BasicInformationArea } from './BasicInformationArea'; | ||
import { IntroductionCard } from './IntroductionCard'; | ||
import { UserInformationSelectedProfile } from './SelectedProfile'; | ||
import { layoutStyle } from './userInformationStyle.css'; | ||
|
||
interface RootProps { | ||
children: ReactNode; | ||
hasCTAButton: boolean; | ||
} | ||
|
||
function UserInformationRoot({ children, hasCTAButton }: RootProps) { | ||
return <div className={layoutStyle({ hasCTAButton })}>{children}</div>; | ||
} | ||
|
||
export const UserInformation = Object.assign(UserInformationRoot, { | ||
BasicInformationArea, | ||
IntroductionCard, | ||
SelectedProfile: UserInformationSelectedProfile, | ||
}); |
Oops, something went wrong.