Skip to content

Commit

Permalink
Revert "Merge pull request #111 from Wingle-SMWU/fix/110CommunityTran…
Browse files Browse the repository at this point in the history
…slationRollback"

This reverts commit 8655232.
  • Loading branch information
yxunakim84 authored and JudithHopps committed Jul 25, 2023
1 parent fa9a313 commit 7ff9a2e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
7 changes: 5 additions & 2 deletions src/components/community/list/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useQuery } from "react-query";
import styled from "styled-components";
import Image from "next/image";
import { useRouter } from "next/router";
import { useTranslation } from "react-i18next";

type Tab = {
tab?: boolean;
Expand All @@ -30,6 +31,8 @@ export default function Header({

const router = useRouter();

const { t } = useTranslation();

if (isLoading) return <div>로딩중</div>;
if (isError || isIdle) return <div>에러</div>;

Expand All @@ -48,10 +51,10 @@ export default function Header({
router.push("/mypage");
}}
/>
<Text.Title1 color="gray900">내가 쓴 게시글</Text.Title1>
<Text.Title1 color="gray900">{t("myPage:mypost")}</Text.Title1>
</>
) : (
<Text.Title1 color="gray900">커뮤니티</Text.Title1>
<Text.Title1 color="gray900">{t("community:main.head")}</Text.Title1>
)}
</S.Header>
<S.HeaderBar>
Expand Down
11 changes: 7 additions & 4 deletions src/components/layout/Navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from "styled-components";
import { Text } from "../../ui";
import useGetProfile from "@/src/hooks/mypage/useGetProfile";
import { theme } from "@/src/styles/theme";
import { useTranslation } from "react-i18next";

type Profile = {
isRadius: boolean;
Expand All @@ -14,25 +15,27 @@ type Tab = {
};

export default function Navigation(props: Tab) {
const { t } = useTranslation();

const router = useRouter();
const menu = router.asPath;

const { profileData } = useGetProfile();
const NavigationMenuArr = [
{
name: "커뮤니티",
name: `${t("navbar:community")}`,
page: "/community",
normalImg: "/community/list/comu-normal.svg",
disableImg: "/community/list/comu-disable.svg",
},
{
name: "쪽지",
name: `${t("navbar:message")}`,
page: "/messages",
normalImg: "/community/list/message-normal.svg",
disableImg: "/community/list/message-disable.svg",
},
{
name: "마이페이지",
name: `${t("navbar:mypage")}`,
page: "/mypage",
normalImg: `
${
Expand All @@ -55,7 +58,7 @@ export default function Navigation(props: Tab) {
{NavigationMenuArr.map((el) => (
<S.NavigationMenu key={el.name} href={el.page}>
<S.NavigationMenuImg
isRadius={el.name === "마이페이지"}
isRadius={el.name === `${t("navbar:mypage")}`}
isActive={props.tab === "mypage"}
src={menu.includes(el.page) ? el.normalImg : el.disableImg}
/>
Expand Down
17 changes: 15 additions & 2 deletions src/pages/community/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,28 @@ import Modal from "@/src/components/modal";
import { Text } from "@/src/components/ui";
import { useRouter } from "next/router";
import { ChangeEvent, useState } from "react";
import { useTranslation } from "react-i18next";
import { useMutation, useQueryClient } from "react-query";
import styled from "styled-components";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { GetStaticProps } from "next";

export const getStaticProps: GetStaticProps = async ({
locale = "en" || "ko",
}) => {
return {
props: { ...(await serverSideTranslations(locale, ["community"])) },
};
};

export default function Create(): JSX.Element {
const router = useRouter();
const { tab: currentTab, forumId } = router.query;
const [contents, setContents] = useState("");
const [modalVisible, setModalVisible] = useState(false);

const { t } = useTranslation();

const queryClient = useQueryClient();

const onChangeContents = (event: ChangeEvent<HTMLTextAreaElement>): void => {
Expand Down Expand Up @@ -83,13 +96,13 @@ export default function Create(): JSX.Element {
color={contents ? "gray900" : "gray500"}
onClick={(): void => updateArticle.mutate()}
>
등록
{t("community:write.done")}
</Text.Body1>
</S.CreateButton>
</S.Header>
<S.Body>
<S.Contents
placeholder="자유롭게 글을 작성해보세요!"
placeholder={t("community:write.leavepost")}
onChange={onChangeContents}
maxLength={3000}
value={contents}
Expand Down
18 changes: 9 additions & 9 deletions src/pages/community/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import styled from "styled-components";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { GetStaticProps } from "next";

// export const getStaticProps: GetStaticProps = async ({
// locale = "en" || "ko",
// }) => {
// return {
// props: {
// ...(await serverSideTranslations(locale, ["community", "navbar"])),
// },
// };
// };
export const getStaticProps: GetStaticProps = async ({
locale = "en" || "ko",
}) => {
return {
props: {
...(await serverSideTranslations(locale, ["community", "navbar"])),
},
};
};

export default function Community(): JSX.Element {
const router = useRouter();
Expand Down

0 comments on commit 7ff9a2e

Please sign in to comment.