Skip to content

Commit

Permalink
Merge pull request #138 from MurakawaTakuya/fix/137-copy-goal-for-onl…
Browse files Browse the repository at this point in the history
…y-authorised-user

アカウントが認証されている場合のみ他の人の目標をコピーするボタンを表示するように変更
  • Loading branch information
MurakawaTakuya authored Jan 8, 2025
2 parents 1dcfb4a + 7c87f17 commit dddd9ba
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
28 changes: 14 additions & 14 deletions src/Components/Account/LoggedInView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,37 +51,37 @@ export default function LoggedInView() {
<Typography level="body-lg" sx={{ textAlign: "center" }}>
ようこそ、{user.name}さん!
</Typography>
<div style={{ display: "flex", flexDirection: "column", gap: "3px" }}>
<Typography level="title-md" sx={{ textAlign: "center" }}>
連続達成日数: {userStats.streak}日目
</Typography>
<Typography level="title-md" sx={{ textAlign: "center" }}>
目標達成率: {userStats.successRate}%
</Typography>
<Typography level="title-md" sx={{ textAlign: "center" }}>
達成回数: {userStats.completed}
</Typography>
</div>
</>
)}

{!user.isMailVerified && (
<Typography color="danger">
メールに届いた認証リンクを確認してください。
認証が完了するまで閲覧以外の機能は制限されます
認証が完了するまで閲覧以外の機能は使用できません
</Typography>
)}

{user.loginType === "Guest" && (
<Typography color="danger">
ゲストユーザーは閲覧以外の機能は制限されます
ゲストユーザーは閲覧以外の機能は使用できません
全ての機能を利用するにはログインが必要です。
</Typography>
)}

{/* ゲストかメール未認証の場合は名前の変更や通知の使用をできないようにする */}
{/* ゲストかメール未認証の場合は閲覧以外の機能を使用できなくする */}
{user.loginType !== "Guest" && user.isMailVerified && (
<>
<div style={{ display: "flex", flexDirection: "column", gap: "3px" }}>
<Typography level="title-md" sx={{ textAlign: "center" }}>
連続達成日数: {userStats.streak}日目
</Typography>
<Typography level="title-md" sx={{ textAlign: "center" }}>
目標達成率: {userStats.successRate}%
</Typography>
<Typography level="title-md" sx={{ textAlign: "center" }}>
達成回数: {userStats.completed}
</Typography>
</div>
<div style={{ display: "flex", justifyContent: "space-evenly" }}>
<NameUpdate />
<NotificationButton />
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Progress/Progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ const GoalCard = ({
{formatStringToDate(deadline)}までに
</Typography>
<div style={{ display: "flex", gap: "5px" }}>
<CopyModalButton deadline={deadline} goalText={goalText} />
{user.loginType !== "Guest" && user.isMailVerified && (
<CopyModalButton deadline={deadline} goalText={goalText} />
)}
{/* 期限の1時間以内、もしくは自分の目標ではない場合は削除できないようにする */}
{!isWithinOneHour && userId === user?.userId && (
<DeleteGoalModal goalId={goalId} />
Expand Down
19 changes: 18 additions & 1 deletion src/app/mycontent/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import DashBoard from "@/Components/DashBoard/DashBoard";
import GoalModalButton from "@/Components/GoalModal/GoalModalButton";
import { useUser } from "@/utils/UserContext";
import Typography from "@mui/joy/Typography";
import { styled } from "@mui/material/styles";
import ToggleButton from "@mui/material/ToggleButton";
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
Expand Down Expand Up @@ -44,7 +45,23 @@ export default function MyContent() {
</CenteredToggleButtonGroup>
</div>

{value === "pending" ? (
{user?.loginType === "Guest" ? (
<Typography
level="body-md"
color="danger"
sx={{ textAlign: "center", marginTop: "20px" }}
>
ゲストログインでは投稿を作成できません。
</Typography>
) : !user?.isMailVerified ? (
<Typography
level="body-md"
color="danger"
sx={{ textAlign: "center", marginTop: "20px" }}
>
メールに届いた認証リンクを確認してください。
</Typography>
) : value === "pending" ? (
<DashBoard
key="pending"
userId={user?.userId}
Expand Down

0 comments on commit dddd9ba

Please sign in to comment.