Skip to content

Commit

Permalink
️💄 edit my activity feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pbc1017 committed Jan 3, 2024
1 parent 966be41 commit 76a665f
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 37 deletions.
17 changes: 13 additions & 4 deletions back/routes/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ router.get("/my_feedback_activity", async (req, res) => {
activity && activity.club ? activity.club.name : "Unknown Club";
const activityName = activity ? activity.title : "Unknown Activity";
const feedbackTypeId = activity ? activity.feedback_type : null;
const activityType = activity ? activity.activity_type_id : null;

// Fetch feedback details
const feedbackDetail = await ActivityFeedback.findOne({
Expand All @@ -246,21 +247,29 @@ router.get("/my_feedback_activity", async (req, res) => {
: null;

// Fetch executive details
const executiveMember = await Member.findByPk(studentId);
// const executiveMember = await Member.findByPk(studentId);

return {
activityId: activity ? activity.id : null,
clubName,
activityName,
feedbackMemberName,
executiveMemberName: executiveMember
? executiveMember.name
: "Unknown Executive",
activityType,
feedbackType: feedbackTypeId,
};
})
);

responseArray.sort((a, b) => {
if (a.clubName < b.clubName) {
return -1;
}
if (a.clubName > b.clubName) {
return 1;
}
return 0;
});

responseArray.sort((a, b) => {
if (a.feedbackType < b.feedbackType) {
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const ActivityProof = ({
fileName,
onDelete,
}: Props): JSX.Element => {
const isImage = url?.match(/\.(jpeg|jpg|gif|png)$/) != null;
const isImage = url?.match(/\.(jpeg|jpg|gif|png|PNG|JPG|JPE|GIF)$/) != null;
const proxyUrl = url
? `${process.env.REACT_APP_BACKEND_URL}/activity/image-proxy?url=${url}`
: "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Props {
club?: string;
activity?: string;
doneby?: string;
chargeof?: string;
activityType?: string;
state?: number;
}

Expand All @@ -26,8 +26,8 @@ export const ActivityFeedbackList = ({
index = "#",
club = "동아리명",
activity = "활동명",
activityType = "활동분류",
doneby = "검토자",
chargeof = "담당자",
state = 1,
}: Props): JSX.Element => {
const navigate = useNavigate();
Expand All @@ -49,10 +49,10 @@ export const ActivityFeedbackList = ({
<div className="text-wrapper-2">{activity}</div>
</div>
<div className="frame-3">
<div className="text-wrapper-2">{doneby}</div>
<div className="text-wrapper-2">{activityType}</div>
</div>
<div className="frame-3">
<div className="text-wrapper-2">{chargeof}</div>
<div className="text-wrapper-2">{doneby}</div>
</div>
<div className="frame-4">
{title === "zero" && <div className="text-wrapper-2">검토 상태</div>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ export const DashboardClubList = ({
);

if (confirmation) {
setSelectedExecutive(newValue);

// Call POST API here
postRequest(
"feedback/update_executive",
{ student_id: newValue, club_id: clubId },
(response) => {
console.log("Post request successful", response.data);
alert("검토 담당자 변경이 완료되었습니다.");
setSelectedExecutive(newValue);
},
(error) => {
console.error("Post request failed", error);
Expand Down
3 changes: 1 addition & 2 deletions front/src/components/admin/DashboardClubList/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
line-height: normal;
margin-top: -1px;
position: relative;
height: 100%;
}

.dashboard-club-list .frame-2 {
Expand All @@ -78,7 +77,7 @@
padding: 10px;
position: relative;
width: 110px;
height: 100%;
height: 105%;
}

.dashboard-club-list .frame-3 {
Expand Down
20 changes: 0 additions & 20 deletions front/src/pages/admin/ActivityAdminDetail/ActivityAdminDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,26 +267,6 @@ export const ActivityAdminDetail = (): JSX.Element => {
</div>
</div>
<UnderBar />
{/* {typeId < 4 && (
<div className="frame-16">
<div
className="frame-17"
onClick={() => navigate(`/edit_activity/${id}`)}
style={{ cursor: "pointer" }}
>
수정
</div>
{durationStatus == 1 && (
<div
className="frame-17"
onClick={handleDeleteActivity}
style={{ cursor: "pointer" }}
>
삭제
</div>
)}
</div>
)} */}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { UpperBar } from "components/home/UpperBar";
import "./ActivityDashboard.css";
import { SubTitle } from "components/home/SubTitle";
import { getRequest } from "utils/api";
import { useExecutiveStatus } from "hooks/useUserPermission";

interface ClubData {
clubName: string;
Expand All @@ -27,6 +28,7 @@ interface DashboardData {
}

export const ActivityDashboard = (): JSX.Element => {
const { executiveStatuses } = useExecutiveStatus();
const [dashboardData, setDashboardData] = useState<DashboardData>({
totalActivities: 0,
nonFeedbackTypeOneActivities: 0,
Expand All @@ -53,7 +55,7 @@ export const ActivityDashboard = (): JSX.Element => {
return (
<div className="activity-dashboard">
<div className="frame-7">
<UpperBar className={"UpperBar"} title={"활동보고서 제출 현황"} />
<UpperBar className={"UpperBar"} title={"활동보고서 대시보드"} />
<div className="frame-wrapper">
<div className="frame-11">
<div className="frame-12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ import { UnderBar } from "components/home/UnderBar";
import "./ActivityFeedbackScreen.css";
import { UpperBar } from "components/home/UpperBar";
import { getRequest } from "utils/api";
import { useExecutiveStatus } from "hooks/useUserPermission";

interface ActivityFeedbackData {
activityId: number;
clubName: string;
activityName: string;
feedbackMemberName: string;
executiveMemberName: string;
activityType: number;
feedbackType: number;
}

export const ActivityFeedbackScreen = (): JSX.Element => {
const { executiveStatuses } = useExecutiveStatus();
const [feedbackActivities, setFeedbackActivities] = useState<
ActivityFeedbackData[]
>([]);
Expand Down Expand Up @@ -51,8 +53,14 @@ export const ActivityFeedbackScreen = (): JSX.Element => {
index={String(index + 1)}
club={activity.clubName}
activity={activity.activityName}
activityType={
activity.activityType === 1
? "내부"
: activity.activityType === 2
? "외부"
: "비합치"
}
doneby={activity.feedbackMemberName}
chargeof={activity.executiveMemberName}
state={activity.feedbackType}
activity_id={activity.activityId}
/>
Expand Down

0 comments on commit 76a665f

Please sign in to comment.