Skip to content

Commit bc05894

Browse files
committed
feat: 점검 공지 추가
1 parent 0eaa02a commit bc05894

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { openKanataApp } from "@/lib/utils";
44
import { trackButtonClick } from "@/lib/analytics";
55

66
export const Header = () => {
7-
const handleClick = () => {
7+
const handleClick = async () => {
88
trackButtonClick("start_btn", "header");
99
openKanataApp();
1010
};

src/components/StartButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface StartButtonProps {
1616
export const StartButton = ({ location }: StartButtonProps) => {
1717
const { toast } = useToast();
1818

19-
const handleClick = (platform?: Platform) => {
19+
const handleClick = async (platform?: Platform) => {
2020
trackButtonClick("start_btn", location);
2121

2222
if (platform === "android") {
@@ -28,7 +28,7 @@ export const StartButton = ({ location }: StartButtonProps) => {
2828
return;
2929
}
3030

31-
openKanataApp(platform);
31+
await openKanataApp(platform);
3232
};
3333

3434
return (

src/lib/utils.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { clsx, type ClassValue } from "clsx";
22
import { twMerge } from "tailwind-merge";
33
import { trackAppOpen } from "./analytics";
4+
import { toast } from "@/components/ui/use-toast";
45

56
export function cn(...inputs: ClassValue[]) {
67
return twMerge(clsx(inputs));
@@ -36,7 +37,21 @@ function getDeviceType(): DeviceType {
3637
return "desktop";
3738
}
3839

39-
export function openKanataApp(platform?: Platform) {
40+
export async function openKanataApp(platform?: Platform) {
41+
const response = await fetch(
42+
"https://storage.kanata.live/kanata-app/status.json"
43+
);
44+
const data = await response.json();
45+
46+
if (data.status === "DOWN") {
47+
toast({
48+
title: "점검 중",
49+
description:
50+
"서비스가 현재 점검 중입니다. 자세한 내용은 X를 확인해 주세요.",
51+
});
52+
return;
53+
}
54+
4055
const deviceType = getDeviceType();
4156
let url: string;
4257

0 commit comments

Comments
 (0)