Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

번쩍 홈/전체/상세 #984

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions pages/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,28 @@ import FeedPanel from '@components/page/detail/Feed/FeedPanel';
import { Fragment, useEffect, useState } from 'react';
import dayjs from 'dayjs';
import 'dayjs/locale/ko';
import { ERecruitmentStatus } from '@constants/option';
import MeetingController from '@components/page/detail/MeetingController';
import { useLightningByIdQuery } from '@api/lightning/hook';
import { GetMeetingResponse } from '@api/API_LEGACY/meeting';
import { GetLightningByIdResponse } from '@api/lightning';

dayjs.locale('ko');

const enum SelectedTab {
FEED,
INFORMATION,
FEED,
}

const DetailPage = () => {
const router = useRouter();
const id = router.query.id as string;
const { data: detailData } = useQueryGetMeeting({ params: { id } });
const { data: meetingData } = useQueryGetMeeting({ params: { id } });
const { data: lightningData } = useLightningByIdQuery({ meetingId: +id });
const { mutate: mutateDeleteMeeting } = useMutationDeleteMeeting({});
const { mutate: mutatePostApplication } = useMutationPostApplication({});
const { mutate: mutateDeleteApplication } = useMutationDeleteApplication({});
const [selectedIndex, setSelectedIndex] = useState(SelectedTab.INFORMATION);

useEffect(() => {
if (detailData) {
setSelectedIndex(detailData.status === ERecruitmentStatus.OVER ? SelectedTab.FEED : SelectedTab.INFORMATION);
}
}, [detailData]);

useEffect(() => {
const script = document.createElement('script');
script.async = true;
Expand All @@ -51,7 +48,7 @@ const DetailPage = () => {
document.body.removeChild(script);
}, []);

if (!detailData) {
if (!meetingData) {
return (
<>
<Loader />
Expand All @@ -68,6 +65,7 @@ const DetailPage = () => {
</>
);
}
const detailData: GetMeetingResponse | GetLightningByIdResponse = lightningData || meetingData;

return (
<>
Expand All @@ -82,18 +80,18 @@ const DetailPage = () => {
<Tab.Group selectedIndex={selectedIndex} onChange={index => setSelectedIndex(index)}>
<STabList>
<Tab as={Fragment}>
<STabButton isSelected={selectedIndex === SelectedTab.FEED}>피드</STabButton>
<STabButton isSelected={selectedIndex === SelectedTab.INFORMATION}>모임 안내</STabButton>
</Tab>
<Tab as={Fragment}>
<STabButton isSelected={selectedIndex === SelectedTab.INFORMATION}>모임 안내</STabButton>
<STabButton isSelected={selectedIndex === SelectedTab.FEED}>피드</STabButton>
</Tab>
</STabList>
<Tab.Panels>
<Tab.Panel>
<FeedPanel isMember={detailData?.approved || detailData?.host} />
<InformationPanel detailData={detailData} />
</Tab.Panel>
<Tab.Panel>
<InformationPanel detailData={detailData} />
<FeedPanel isMember={detailData?.approved || detailData?.host} />
</Tab.Panel>
</Tab.Panels>
</Tab.Group>
Expand Down
12 changes: 6 additions & 6 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useQueryGetGroupBrowsingCard } from '@api/API_LEGACY/meeting/hooks';
import { useInfinitePosts } from '@api/post/hooks';
import Carousel from '@components/groupBrowsing/Carousel/Carousel';
import GroupBrowsingSlider from '@components/groupBrowsingSlider/groupBrowsingSlider';
Expand All @@ -16,6 +15,7 @@ import { styled } from 'stitches.config';
import CrewTab from '@components/CrewTab';
import HomeCardList from '@components/page/home/HomeCardList';
import { useGetRecommendMeetingListQuery } from '@api/meeting/hook';
import { useLightningListQuery } from '@api/lightning/hook';

const Home: NextPage = () => {
const { isLaptop, isTablet } = useDisplay();
Expand All @@ -24,7 +24,7 @@ const Home: NextPage = () => {

const { fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = useInfinitePosts(TAKE_COUNT);

const { data: groupBrowsingCardData } = useQueryGetGroupBrowsingCard();
const lightningList = useLightningListQuery().data?.meetings;
const { data: inProgressMeetings } = useGetRecommendMeetingListQuery({ meetingIds: [] });

useEffect(() => {
Expand All @@ -40,15 +40,15 @@ const Home: NextPage = () => {
{isTablet ? (
<>
<SContentTitle style={{ marginTop: '16px' }}>⚡ ️솝트만의 일회성 모임, 번쩍</SContentTitle>
{groupBrowsingCardData && <GroupBrowsingSlider cardList={groupBrowsingCardData}></GroupBrowsingSlider>}
{lightningList && <GroupBrowsingSlider cardList={lightningList}></GroupBrowsingSlider>}
</>
) : (
<>
<Flex align="center" justify="center">
<SContentTitle style={{ marginTop: '54px' }}>⚡ ️솝트만의 일회성 모임, 번쩍</SContentTitle>
</Flex>
<GroupBrowsingCarouselContainer>
{groupBrowsingCardData && <Carousel cardList={groupBrowsingCardData} />}
{lightningList && <Carousel cardList={lightningList} />}
</GroupBrowsingCarouselContainer>
</>
)}
Expand All @@ -57,12 +57,12 @@ const Home: NextPage = () => {
<QuickMenuWrapper>
<QuickMenu />
</QuickMenuWrapper>
{inProgressMeetings && <HomeCardList groupBrowsingCardData={inProgressMeetings} />}
{inProgressMeetings && <HomeCardList inProgressMeetingData={inProgressMeetings} />}
</Flex>
) : (
<>
<Flex justify="center" style={{ marginTop: '72px' }}>
{inProgressMeetings && <HomeCardList groupBrowsingCardData={inProgressMeetings} />}
{inProgressMeetings && <HomeCardList inProgressMeetingData={inProgressMeetings} />}
<div style={{ paddingLeft: '106px' }}>
<QuickMenu />
</div>
Expand Down
28 changes: 15 additions & 13 deletions pages/make/bungae/index.tsx → pages/make/lightning/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form';
import { BungaeFormType, bungaeSchema } from '@type/form';
import { LightningFormType, lightningSchema } from '@type/form';
import { styled } from 'stitches.config';
import { zodResolver } from '@hookform/resolvers/zod';
import { useRouter } from 'next/router';
Expand All @@ -10,21 +10,21 @@ import { ampli } from '@/ampli';
import { fontsObject } from '@sopt-makers/fonts';
import { colors } from '@sopt-makers/colors';
import Presentation from '@components/form/Bungae';
import { createBungae } from '@api/meeting';
import { createLightning } from '@api/lightning';

const DevTool = dynamic(() => import('@hookform/devtools').then(module => module.DevTool), {
ssr: false,
});

const Bungae = () => {
const Lightning = () => {
const router = useRouter();
const formMethods = useForm<BungaeFormType>({
const formMethods = useForm<LightningFormType>({
mode: 'onChange',
resolver: zodResolver(bungaeSchema),
resolver: zodResolver(lightningSchema),
});
const { isValid, errors } = formMethods.formState;
const { mutateAsync: mutateCreateBungae, isLoading: isSubmitting } = useMutation({
mutationFn: (formData: BungaeFormType) => createBungae(formData),
const { mutateAsync: mutateCreateLightning, isLoading: isSubmitting } = useMutation({
mutationFn: (formData: LightningFormType) => createLightning(formData),
onError: () => {
alert('번쩍을 개설하지 못했습니다.');
},
Expand All @@ -42,11 +42,13 @@ const Bungae = () => {
formMethods.setValue('files', files);
};

const onSubmit: SubmitHandler<BungaeFormType> = async formData => {
const bungaeId = await mutateCreateBungae(formData);
ampli.completedMakeGroup();
alert('번쩍을 개설했습니다.');
router.push(`/detail?id=${bungaeId}`);
const onSubmit: SubmitHandler<LightningFormType> = async formData => {
mutateCreateLightning(formData, {
onSuccess: data => {
ampli.completedMakeGroup();
router.push(`/detail?id=${data}`);
},
});
};

return (
Expand Down Expand Up @@ -78,7 +80,7 @@ const Bungae = () => {
);
};

export default Bungae;
export default Lightning;

const SContainer = styled('div', {
margin: '80px 0',
Expand Down
2 changes: 0 additions & 2 deletions pages/mine/management/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { useRouter } from 'next/router';
import Link from 'next/link';
import { styled } from 'stitches.config';
import { TabList } from '@components/@common/tabList/TabList';
import ManagementListSkeleton from '@components/page/mine/management/Skeleton/ManagementListSkeleton';
import MeetingInformationSkeleton from '@components/page/mine/management/Skeleton/MeetingInformationSkeleton';
import ManagementListItem from '@components/page/mine/management/ManagementListItem';
Expand Down
2 changes: 1 addition & 1 deletion pages/post/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function PostPage() {
mutationFn: (comment: string) =>
POST('/comment/v2', {
body: {
postId: post!.id,
postId: post?.id,
contents: comment,
isParent: parentComment.parentComment,
parentCommentId: parentComment.parentComment ? null : parentComment.parentCommentId,
Expand Down
3 changes: 3 additions & 0 deletions public/assets/svg/icon_bolt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/svg/icon_event.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions public/assets/svg/icon_seminar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/svg/icon_study.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions public/assets/svg/location.svg

This file was deleted.

Loading
Loading