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

[Feat] 선착순 밸런스 게임 이벤트 공유 링크 연동 #171

Merged
merged 4 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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: 3 additions & 1 deletion .github/workflows/client_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:


- name: Create .env file
run: echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" > ./.env
run: |
echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" >> ./.env
echo "VITE_RUSH_URL=${{ secrets.VITE_RUSH_URL }}" >> ./.env
working-directory: ${{ env.working-directory }}

# build
Expand Down
12 changes: 10 additions & 2 deletions client/src/pages/RushGame/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ import Countdown from "@/features/RushGame/RushGameSections/Countdown.tsx";
import FinalResult from "@/features/RushGame/RushGameSections/FinalResult.tsx";
import SelectedCard from "@/features/RushGame/RushGameSections/SelectedCard.tsx";
import { useRushGameContext } from "@/hooks/useRushGameContext.ts";
import useToast from "@/hooks/useToast.tsx";
import { writeClipboard } from "@/utils/writeClipboard.ts";

// TODO: 계속 카운트 다운에 맞춰 매초 렌더링 되는 문제 해결
export default function RushGame() {
const { gameState } = useRushGameContext();
const { showToast, ToastComponent } = useToast("링크가 복사되었어요!");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const handleClickShareButton = () => {
writeClipboard(import.meta.env.VITE_RUSH_URL, showToast);
};

const renderRushGameContent = () => {
// console.log(gameState.phase);
switch (gameState.phase) {
case CARD_PHASE.NOT_STARTED:
return <Countdown />;
Expand All @@ -40,8 +46,10 @@ export default function RushGame() {
<p className="h-body-2-regular text-n-neutral-500">
우리 편에 투표할 친구를 불러오세요!
</p>
<CTAButton label="이벤트 링크 공유" />
<CTAButton label="이벤트 링크 공유" onClick={handleClickShareButton} />
</motion.div>

{ToastComponent}
</section>
);
}
Loading