Skip to content

Commit

Permalink
Merge pull request #171 from softeerbootcamp4th/feat/#165-rush-share-…
Browse files Browse the repository at this point in the history
…link

[Feat] 선착순 밸런스 게임 이벤트 공유 링크 연동
  • Loading branch information
sooyeoniya authored Aug 19, 2024
2 parents e840df6 + 83df9b2 commit 0ffefd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
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("🔗 링크가 복사되었어요!");

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>
);
}

0 comments on commit 0ffefd3

Please sign in to comment.