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

fix: webDomain basePath 함수 수정 #107

Merged
merged 9 commits into from
Aug 18, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/deploy-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ jobs:
destination-repository-name: ${{needs.variable.outputs.DESTINATION_REPOSITORY}}
user-email: ${{secrets.EMAIL}}
commit-message: 'chore: ${{inputs.user_name}} deploy ${{inputs.stage}}'
target-branch: ${{inputs.stage == 'prodction' && 'main' || 'main' }}
target-branch: ${{inputs.stage == 'production' && 'main' || 'main' }}
- name: get deploy information
id: deploy-information
run: echo "target-repository=${{needs.variable.outputs.DESTINATION_REPOSITORY}}" >> "$GITHUB_OUTPUT" |
echo "target-branch=${{inputs.stage == 'prodction' && 'main' || 'main' }}" >> "$GITHUB_OUTPUT"
echo "target-branch=${{inputs.stage == 'production' && 'main' || 'main' }}" >> "$GITHUB_OUTPUT"
info:
name: get deploy information
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Txt } from '@sambad/sds/components';
import { colors } from '@sambad/sds/theme';
import dayjs from 'dayjs';
import dynamic from 'next/dynamic';
import { HTMLAttributes } from 'react';
import Countdown from 'react-countdown';

import { getRemainTime } from '../../../../home/common/utils/getRemainTime';

interface AnswerCountDownProps extends HTMLAttributes<HTMLDivElement> {
timer: string | number | Date;
}

const CountdownRender = dynamic(() => import('./AnswerCountdownRender.tsx').then((mod) => mod.AnswerCountdownRender), {
ssr: true,
});

export const AnswerCountDown = ({ timer, ...rest }: AnswerCountDownProps) => {
const remainTime = getRemainTime(timer);

const isTenminuteleft = remainTime <= dayjs().minute(10).valueOf();

return (
<section
css={{
width: '100%',
padding: '0 40px',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
{...rest}
>
<Txt as="p" typography="body4" css={{ marginBottom: '8px' }} color={colors.grey600}>
마감까지 남은 시간
</Txt>
<Countdown
date={remainTime}
renderer={({ hours, minutes, seconds }) => (
<CountdownRender hours={hours} minutes={minutes} seconds={seconds} isTenminuteleft={isTenminuteleft} />
)}
/>
</section>
);
};
Original file line number Diff line number Diff line change
@@ -1,45 +1,7 @@
import { Txt } from '@sambad/sds/components';
import { borderRadiusVariants, colors, shadow } from '@sambad/sds/theme';
import dayjs from 'dayjs';
import { HTMLAttributes } from 'react';
import Countdown from 'react-countdown';
import { Txt } from '@sds/components';
import { colors, borderRadiusVariants, shadow } from '@sds/theme';

import { getRemainTime } from '../../../home/common/utils/getRemainTime';

interface AnswerCountDownProps extends HTMLAttributes<HTMLDivElement> {
timer: string | number | Date;
}

export const AnswerCountDown = ({ timer, ...rest }: AnswerCountDownProps) => {
const remainTime = getRemainTime(timer);

const isTenminuteleft = remainTime <= dayjs().minute(10).valueOf();

return (
<section
css={{
width: '100%',
padding: '0 40px',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
{...rest}
>
<Txt as="p" typography="body4" css={{ marginBottom: '8px' }} color={colors.grey600}>
마감까지 남은 시간
</Txt>
<Countdown
date={remainTime}
renderer={({ hours, minutes, seconds }) => (
<CountdownRender hours={hours} minutes={minutes} seconds={seconds} isTenminuteleft={isTenminuteleft} />
)}
/>
</section>
);
};

const CountdownRender = ({
export const AnswerCountdownRender = ({
hours,
minutes,
seconds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { KakaoShareModal } from '@/common';

import { AnswerCountDown } from '../../../common/components/AnswerCountdown';
import { AnswerCountDown } from '../../../common/components/Countdown/AnswerCountdown';
import { ClosingButton } from '../../floating-button/components/ClosingButton';
import { ClosingMessage } from '../components/ClosingMessage';
import { useAnswerClosingService } from '../services/useAnswerClosingService';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const useAnswerClosingService = () => {
const { close, isOpen } = useDialogContext();
const answerGlobalTime = useAtomValue(answerAtoms.answerGlobalTime);
const basePath = getWebDomain();

return {
answerGlobalTime: answerGlobalTime ?? 0,
isOpen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Txt } from '@sambad/sds/components';
import { colors } from '@sambad/sds/theme';

import { AnswerCountDown } from '../../../common/components/AnswerCountdown';
import { AnswerCountDown } from '../../../common/components/Countdown/AnswerCountdown';
import { StartButton } from '../../floating-button/components/StartButton';
import { QuestionInfo } from '../components/QuestionInfo';
import { ResponseGuageBar } from '../components/ResponseGuageBar';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface ShareToKakaoProps {

export const generateKakaoShare = ({ shareLink, shareImageUrl, shareDescription }: ShareToKakaoProps) => {
const { Kakao } = window;
console.log(shareLink);

Kakao.Share.sendDefault({
objectType: 'feed',
content: {
Expand Down
12 changes: 0 additions & 12 deletions packages/web-domains/src/common/getWebdomain.ts

This file was deleted.

13 changes: 7 additions & 6 deletions packages/web-domains/src/common/utils/getWebDomain.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const STAGE = process.env.NEXT_PUBLIC_STAGE;

export const getWebDomain = () => {
const NEXT_PUBLIC_STAGE = process.env.NEXT_PUBLIC_STAGE;
if (STAGE === 'production') {
return 'https://moring.one';
}

switch (NEXT_PUBLIC_STAGE) {
case 'production':
return 'https://moring.one';
case 'development':
return 'https://dev.moring.one';
if (STAGE === 'development') {
return 'https://dev.moring.one';
}

return 'https://local.moring.one:3000';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export async function getTopPreviousQuestionList(
Cookie: cookie?.toString(),
},
});
console.log(data);

return data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { ArrivedQuestionNotification } from '../components/ArrivedQuestionNotifi
import { SelectedTargetMemberNotification } from '../components/SelectedTargetMemberNotification';
import { useNotificationService } from '../services/useNotificationService';
export const NotificationContainer = () => {
const { notfication, handleClose, isOpen, isNotAnswerd } = useNotificationService();
const { notfication, handleClose, isOpen, isNotAnswerd, isNotRegistered } = useNotificationService();

return (
<>
{notfication?.eventType === 'QUESTION_REGISTERED' && isNotAnswerd && (
<ArrivedQuestionNotification isOpen={isOpen} onClose={handleClose} />
)}
{notfication?.eventType === 'TARGET_MEMBER' && (
{notfication?.eventType === 'TARGET_MEMBER' && isNotRegistered && (
<SelectedTargetMemberNotification isOpen={isOpen} onClose={handleClose} />
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ export const useNotificationService = () => {
handleClose,
isRefetching,
isNotAnswerd: !progressingQuestionData?.isAnswered,
isNotRegistered: !progressingQuestionData?.isQuestionRegistered,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'use client';

import { Txt } from '@sds/components';
import { borderRadiusVariants, colors } from '@sds/theme';

export const InActiveCountdownRender = ({
hours,
minutes,
seconds,
}: {
hours: number;
minutes: number;
seconds: number;
}) => {
const renderHours = hours < 10 ? `0${hours}` : `${hours}`;
const renderMinutes = minutes < 10 ? `0${minutes}` : `${minutes}`;
const renderseconds = seconds < 10 ? `0${seconds}` : `${seconds}`;

return (
<div
css={{
width: '97px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '29px',
padding: '4px 8px',
borderRadius: borderRadiusVariants.medium,
backgroundColor: colors.grey300,
marginTop: '16px',
}}
>
<Txt typography="title3" color={colors.grey600}>
{renderHours}
</Txt>
<Txt typography="title3" color={colors.grey600} css={{ padding: '0 4px' }}>
:
</Txt>
<Txt typography="title3" color={colors.grey600}>
{renderMinutes}
</Txt>
<Txt typography="title3" color={colors.grey600} css={{ padding: '0 4px' }}>
:
</Txt>
<Txt typography="title3" color={colors.grey600}>
{renderseconds}
</Txt>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
'use client';

import { Txt } from '@sambad/sds/components';
import { borderRadiusVariants, colors } from '@sambad/sds/theme';
import { colors } from '@sambad/sds/theme';
import dynamic from 'next/dynamic';
import Countdown from 'react-countdown';

import { ClockIcon } from '../../../../../common/asset/clock';
import { MemberType } from '../../../../common/apis/schema/useGetProgressingQuestionQuery.type';
import { Avatar } from '../../../../common/components/Avatar/Avatar';
import { getRemainTime } from '../../../../common/utils/getRemainTime';

const CountdownRender = dynamic(
() => import('./InActiveCountdownRender.tsx').then((mod) => mod.InActiveCountdownRender),
{
ssr: true,
},
);

interface InActiveQuestionProps {
time: number;
targetMember: MemberType;
Expand All @@ -20,52 +28,19 @@ export const InActiveQuestion = ({ time, targetMember }: InActiveQuestionProps)
const timer = getRemainTime(time);

return (
<div css={{ backgroundColor: colors.white, padding: '32px 20px', borderRadius: '16px' }}>
<div css={{ backgroundColor: colors.white, padding: '32px 20px', borderRadius: '16px', height: '182px' }}>
<div css={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexDirection: 'column' }}>
<Avatar Icon={ClockIcon} size={40} />
<Txt as="p" typography="title3" color={colors.grey600} css={{ marginTop: '12px' }}>
{name}님의 질문을 기다리고 있어요
</Txt>
<Countdown date={timer} renderer={CountdownRender} />
<Countdown
date={timer}
renderer={({ hours, minutes, seconds }) => (
<CountdownRender hours={hours} minutes={minutes} seconds={seconds} />
)}
/>
</div>
</div>
);
};

const CountdownRender = ({ hours, minutes, seconds }: { hours: number; minutes: number; seconds: number }) => {
const renderHours = hours < 10 ? `0${hours}` : `${hours}`;
const renderMinutes = minutes < 10 ? `0${minutes}` : `${minutes}`;
const renderseconds = seconds < 10 ? `0${seconds}` : `${seconds}`;

return (
<div
css={{
width: '97px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '29px',
padding: '4px 8px',
borderRadius: borderRadiusVariants.medium,
backgroundColor: colors.grey300,
marginTop: '16px',
}}
>
<Txt typography="title3" color={colors.grey600}>
{renderHours}
</Txt>
<Txt typography="title3" color={colors.grey600} css={{ padding: '0 4px' }}>
:
</Txt>
<Txt typography="title3" color={colors.grey600}>
{renderMinutes}
</Txt>
<Txt typography="title3" color={colors.grey600} css={{ padding: '0 4px' }}>
:
</Txt>
<Txt typography="title3" color={colors.grey600}>
{renderseconds}
</Txt>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { colors, size } from '@sambad/sds/theme';
import Link from 'next/link';
import { useState } from 'react';

import { KakaoShareModal } from '@/common';
import { getWebDomain } from '@/common/getWebdomain';
import { KakaoShareModal, getWebDomain } from '@/common';
import { findCurrentMeetingId } from '@/relay-question/utils/findCurrentMeetingId';

import { ShareGroupBackground } from '../../../../assets/ShareGroupBackground';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { colors, size } from '@sambad/sds/theme';
import Link from 'next/link';
import { useState } from 'react';

import { KakaoShareModal } from '@/common';
import { getWebDomain } from '@/common/getWebdomain';
import { KakaoShareModal, getWebDomain } from '@/common';
import { useActiveQuestionQuery } from '@/relay-question/features/share-group/hooks/useActiveQuestionQuery';
import { useMyMeetingsQuery } from '@/relay-question/features/start-relay-question/hooks/queries/useMyMeetingsQuery';
import { findCurrentMeetingId } from '@/relay-question/utils/findCurrentMeetingId';
Expand Down
Loading