Skip to content

Commit

Permalink
refactor: 불필요한 코드 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
soyoung125 committed May 28, 2024
1 parent eb3a40b commit fd7c9a2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { SESSION_STORAGE_KEY_TOKEN } from "@api/keys.ts";
import { DOMAIN } from "@api/url.ts";
import { RegularAssetsRequest } from "@app/types/asset.ts";
import { useQuery } from "@tanstack/react-query";
import {
QUERY_KEY_REGULAR_ASSET,
QUERY_KEY_SCHEDULES,
} from "@constants/queryKeys.ts";
import { QUERY_KEY_REGULAR_ASSET } from "@constants/queryKeys.ts";
import { Schedule } from "@app/types/schedule.ts";

const fetchRegularAssets = async (query: RegularAssetsRequest) => {
Expand Down
12 changes: 12 additions & 0 deletions src/components/ScheduleDrawer/ScheduleDrawer.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { styled } from "@mui/material";
import { grey } from "@mui/material/colors";

export const Puller = styled("div")(({ theme }) => ({
width: 30,
height: 6,
backgroundColor: theme.palette.mode === "light" ? grey[300] : grey[900],
borderRadius: 3,
position: "absolute",
top: 8,
left: "calc(50% - 15px)",
}));
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Avatar, Stack, Typography } from "@mui/material";
import { Stack, Typography } from "@mui/material";
import { CATEGORY_ICONS } from "@components/ScheduleList/constants.ts";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import { useOverlay } from "@hooks/use-overlay/useOverlay.tsx";
import { styled, SwipeableDrawer } from "@mui/material";
import CssBaseline from "@mui/material/CssBaseline";
import { grey } from "@mui/material/colors";
import SettingDrawer from "@pages/AssetManagement/pages/SavingGoal/components/GoalSetting/SettingDrawer/SettingDrawer.tsx";
import { getAmount } from "@pages/AssetManagement/utils.ts";
import { useDialog } from "@hooks/dialog/useDialog.tsx";
import { MonthSavingGoal } from "@app/types/asset.ts";
import useSavingGoal from "@hooks/assetManagement/useSavingGoal.ts";

const Puller = styled("div")(({ theme }) => ({
width: 30,
height: 6,
backgroundColor: theme.palette.mode === "light" ? grey[300] : grey[900],
borderRadius: 3,
position: "absolute",
top: 8,
left: "calc(50% - 15px)",
}));
import { Puller } from "@components/ScheduleDrawer/ScheduleDrawer.styles.ts";

export const useSettingGoalDrawer = () => {
const { openOverlay, closeOverlay } = useOverlay();
Expand Down
48 changes: 0 additions & 48 deletions src/pages/AssetManagement/pages/SpendingGoal/SpendingGoal.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import useSpendingGoal from "@hooks/assetManagement/useSpendingGoal.ts";
import { Box, Stack } from "@mui/material";
import MonthSpendingGoal from "@pages/AssetManagement/pages/SpendingGoal/components/MonthSpendingGoal";
import RegularSpendingGoal from "@pages/AssetManagement/pages/SpendingGoal/components/RegularSpendingGoal";
import { useModal } from "@hooks/modal/useModal.tsx";
import { Form } from "@pages/AssetManagement/pages/SpendingGoal/components/RegularSpendingGoal/ModifyRegularSpendingGoal.tsx";
import ConfirmModal from "pages/AssetManagement/pages/SpendingGoal/components/RegularSpendingGoal/components/ConfirmModal";
import { useState } from "react";
import ModifyModal from "pages/AssetManagement/pages/SpendingGoal/components/MonthSpendingGoal/components/ModifyModal";
import { getDate } from "@pages/AssetManagement/pages/SpendingGoal/utils.ts";
import moment from "moment";
import { getAmount } from "@pages/AssetManagement/utils.ts";
import RoundedPaper from "@components/common/RoundedPaper.tsx";
Expand All @@ -17,7 +12,6 @@ import ReportLayout from "@pages/reports/Report/components/layout/ReportLayout";
function SpendingGoal() {
const {
offSpendAmount,
onSpendAmount,
monthlyReport,
userName,
yearMonth,
Expand All @@ -34,8 +28,6 @@ function SpendingGoal() {
is_batch: false,
};

const [isModify, setIsModify] = useState(false);

const handleModify = () => {
openModal({
modalElement: (
Expand All @@ -55,37 +47,6 @@ function SpendingGoal() {
});
};

const handleSubmit = (form: Form) => {
if (offSpendAmount.spend_goal_amount !== "?") {
openModal({
modalElement: (
<ConfirmModal
closeModal={closeModal}
handleApprove={() => {
changeRegularGoal(form, true);
}}
handleReject={() => {
changeRegularGoal(form, false);
}}
/>
),
isBackdropClickable: false,
});
} else {
changeRegularGoal(form, true);
}
};

const changeRegularGoal = (form: Form, isBatch: boolean) => {
handleSetSpendingGoal({
...form,
regular: "ON" as const,
is_batch: isBatch,
});
setIsModify(false);
closeModal();
};

return (
<Stack spacing={4} px={2.5} pt={2.5}>
<Box sx={{ fontSize: "20px", fontWeight: 500 }}>
Expand Down Expand Up @@ -116,15 +77,6 @@ function SpendingGoal() {
}
/>
</RoundedPaper>
{/*<RegularSpendingGoal*/}
{/* handleModify={() => setIsModify(true)}*/}
{/* handleSubmit={handleSubmit}*/}
{/* closeModify={() => setIsModify(false)}*/}
{/* isModify={isModify}*/}
{/* goal={onSpendAmount.spend_goal_amount}*/}
{/* startDate={getDate(onSpendAmount.start_date) ?? yearMonth}*/}
{/* endDate={getDate(onSpendAmount.end_date) ?? yearMonth}*/}
{/*/>*/}
</Stack>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function MonthSpendingGoal({
changeYearAndMonth,
handleModify,
goal,
spent,
}: MonthSpendingGoalProps) {
return (
<RoundedPaper my={2}>
Expand Down

0 comments on commit fd7c9a2

Please sign in to comment.