Skip to content
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
Binary file added src/assets/images/slack_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/ranking/RankingRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const RankingRow = ({ row }: RankingRowProps) => {
"relative grid grid-cols-7 items-center py-4 border-b text-sm",
row.newUser
? "border-green-100 bg-gradient-to-r from-green-100/80 to-transparent"
: "border-blue-200",
: "border-gray-500",
].join(" ")}
>
<div className="relative text-center">
Expand Down
39 changes: 39 additions & 0 deletions src/components/signup/WorkSpaceButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react";
import slackLogo from "@/assets/images/sub_logo.png";

interface Props {
onClick: () => void;
}

const WorkSpaceButton: React.FC<Props> = ({ onClick }) => {
return (
<button
onClick={onClick}
aria-label="워크스페이스 가입하기"
Comment on lines +10 to +12

Choose a reason for hiding this comment

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

high

button 요소에 type 속성을 명시하는 것이 좋습니다. type의 기본값은 "submit"이므로, 이 버튼이 <form> 내부에 위치하게 될 경우 의도치 않게 form을 제출할 수 있습니다. type="button"을 추가하여 이러한 예기치 않은 동작을 방지해주세요.

    <button
      type="button"
      onClick={onClick}
      aria-label="워크스페이스 가입하기"

className="
flex items-center justify-center gap-3
w-[400px] md:w-[480px] max-w-[85%] h-[60px]
bg-white border border-gray-300 rounded-xl

shadow-sm
hover:shadow-md hover:bg-gray-50
active:shadow-sm active:scale-[0.97]

transition-all duration-200 ease-out
select-none
"
Comment on lines +13 to +24

Choose a reason for hiding this comment

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

medium

여러 줄의 className 문자열은 가독성을 해치고 잠재적인 공백 문제를 일으킬 수 있습니다. RankingRow.tsx에서 사용된 것처럼 클래스 이름 배열을 join(" ")으로 결합하는 방식을 사용하면 더 깔끔하고 일관성 있는 코드를 유지할 수 있습니다.

      className={[
        "flex items-center justify-center gap-3",
        "w-[400px] md:w-[480px] max-w-[85%] h-[60px]",
        "bg-white border border-gray-300 rounded-xl",
        "shadow-sm",
        "hover:shadow-md hover:bg-gray-50",
        "active:shadow-sm active:scale-[0.97]",
        "transition-all duration-200 ease-out",
        "select-none",
      ].join(" ")}

>
<img
src={slackLogo}
alt="Slack Logo"
className="h-[14px] w-auto md:h-[16px]"
/>

<span className="text-gray-800 text-lg md:text-xl font-medium tracking-tight">
Workspace 가입하기
</span>
</button>
);
};

export default WorkSpaceButton;
27 changes: 18 additions & 9 deletions src/pages/auth/LoginPage.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
import SlackLoginButton from "@/components/signup/SlackLoginButton";
import WorkSpaceButton from "@/components/signup/WorkSpaceButton";
import mainLogo from "@/assets/images/main_logo.png";

export const SLACK_CLIENT_ID = import.meta.env.VITE_SLACK_CLIENT_ID;
export const SLACK_REDIRECT_URI = import.meta.env.VITE_SLACK_REDIRECT_URI;

const INVITE_URL =
"https://join.slack.com/t/slackjudge/shared_invite/zt-3jvozgq6d-~pNce8kQdm6SFy4InCmryA";
Comment on lines +8 to +9

Choose a reason for hiding this comment

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

medium

INVITE_URL과 같은 설정 값은 하드코딩하는 대신 환경 변수로 관리하는 것이 좋습니다. 이렇게 하면 다른 환경(개발, 스테이징, 프로덕션)에서 다른 값을 사용하기 용이하고, 코드를 변경하지 않고도 URL을 업데이트할 수 있어 유지보수성이 향상됩니다. .env 파일에 VITE_SLACK_INVITE_URL과 같은 변수를 추가하고 import.meta.env.VITE_SLACK_INVITE_URL로 불러와 사용해주세요.

Suggested change
const INVITE_URL =
"https://join.slack.com/t/slackjudge/shared_invite/zt-3jvozgq6d-~pNce8kQdm6SFy4InCmryA";
const INVITE_URL = import.meta.env.VITE_SLACK_INVITE_URL;


export default function LoginPage() {

const handleSlackLogin = () => {
window.location.href = `https://slack.com/openid/connect/authorize?scope=email openid profile&client_id=${SLACK_CLIENT_ID}&redirect_uri=${SLACK_REDIRECT_URI}&response_type=code`
};

const handleWorkSpace = () => {
window.open(INVITE_URL, "_blank", "noopener,noreferrer");
};
Comment on lines 13 to +19

Choose a reason for hiding this comment

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

medium

handleSlackLoginhandleWorkSpace 함수는 컴포넌트가 렌더링될 때마다 새로 생성됩니다. 이 함수들은 props나 state에 의존하지 않으므로 React.useCallback으로 감싸서 불필요한 재생성을 방지하는 것이 성능 최적화에 좋습니다. (파일 상단에 import React from "react"; 추가가 필요할 수 있습니다.)

Suggested change
const handleSlackLogin = () => {
window.location.href = `https://slack.com/openid/connect/authorize?scope=email openid profile&client_id=${SLACK_CLIENT_ID}&redirect_uri=${SLACK_REDIRECT_URI}&response_type=code`
};
const handleWorkSpace = () => {
window.open(INVITE_URL, "_blank", "noopener,noreferrer");
};
const handleSlackLogin = React.useCallback(() => {
window.location.href = `https://slack.com/openid/connect/authorize?scope=email openid profile&client_id=${SLACK_CLIENT_ID}&redirect_uri=${SLACK_REDIRECT_URI}&response_type=code`
}, []);
const handleWorkSpace = React.useCallback(() => {
window.open(INVITE_URL, "_blank", "noopener,noreferrer");
}, []);


return (
<div className="
min-h-screen flex flex-col items-center justify-center
bg-white px-4
">
<div className="min-h-screen flex flex-col items-center justify-center bg-white px-4">
<img
src={mainLogo}
alt="Slack Judge"
className="
w-[240px] md:w-[280px] lg:w-[300px]
mb-14 md:mb-16
"
className="w-[240px] md:w-[280px] lg:w-[300px] mb-14 md:mb-16"
/>

<SlackLoginButton onClick={handleSlackLogin} />
<div className="w-full flex flex-col items-center gap-4">
<WorkSpaceButton onClick={handleWorkSpace} />
<SlackLoginButton onClick={handleSlackLogin} />
</div>

<div className="w-[400px] md:w-[480px] max-w-[85%] text-center text-sm text-gray-400 leading-relaxed">
워크스페이스에 가입한 후, 로그인을 진행해주세요.

Choose a reason for hiding this comment

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

medium

안내 문구에 오타가 있습니다. 쉼표 뒤에 공백이 두 개 들어가 있습니다. 하나로 수정해주세요.

Suggested change
워크스페이스에 가입한 , 로그인을 진행해주세요.
워크스페이스에 가입한 , 로그인을 진행해주세요.

</div>
</div>
);
}
Loading