Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tech stack functionality p2 #144

Merged
merged 28 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b406533
remove padding from Container.
MattRueter Jun 4, 2024
4f39919
create service file.
MattRueter Jun 4, 2024
91364d0
Merge branch 'dev' into feature/tech-stack-functionality-p2
MattRueter Jun 5, 2024
6828911
fix form not connected error.
MattRueter Jun 5, 2024
75d6581
add delete functionality.
MattRueter Jun 6, 2024
9cc804f
add AddtechItem functionality p-1
MattRueter Jun 6, 2024
d8600c3
add editing techItem functionality.
MattRueter Jun 6, 2024
95ed7ad
get users voyageTeamMemberId for use in addTechStack functionality & …
MattRueter Jun 6, 2024
b4a43bd
clean linting errors.
MattRueter Jun 6, 2024
f007140
focus on input when toggled open.
MattRueter Jun 6, 2024
06966ad
Merge branch 'dev' into feature/tech-stack-functionality-p2
Dan-Y-Ko Jun 7, 2024
865798c
move Spinner to buttons.
MattRueter Jun 12, 2024
72cfeb1
change padding on edit form to fix borders.
MattRueter Jun 12, 2024
fa99ad3
Merge branch 'dev' into feature/tech-stack-functionality-p2
MattRueter Jun 12, 2024
3fd99d3
Merge branch 'feature/tech-stack-functionality-p2' of github.com:chin…
MattRueter Jun 12, 2024
b0d09b4
adjust margin of li. & open input with item name as defaultValue.
MattRueter Jun 13, 2024
1ec7bbb
replace boolean check with ternary.
MattRueter Jun 13, 2024
03a21ea
change isEditing to editItemId.
MattRueter Jun 13, 2024
b9bf51c
Merge branch 'dev' into feature/tech-stack-functionality-p2
MattRueter Jun 19, 2024
a679ca6
decouple SettingsMenu and RemoveVoteBtn.
MattRueter Jun 19, 2024
f03759e
get voyageMemberTeamId from getCurrentVoyageTeam util.
MattRueter Jun 19, 2024
dd42c05
comment out unused id for now.
MattRueter Jun 19, 2024
fee2bd0
Merge branch 'dev' into feature/tech-stack-functionality-p2
MattRueter Jun 25, 2024
ba7d92c
create validation schema for adding.
MattRueter Jun 25, 2024
43b21ae
write add tech item validation.
MattRueter Jun 26, 2024
758b276
add editing validation.
MattRueter Jun 26, 2024
523657b
Merge branch 'dev' into feature/tech-stack-functionality-p2
MattRueter Jun 26, 2024
a7eda57
Merge branch 'dev' into feature/tech-stack-functionality-p2
Dan-Y-Ko Jun 28, 2024
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
Original file line number Diff line number Diff line change
@@ -1,53 +1,23 @@
import type { Dispatch, SetStateAction } from "react";
import { EllipsisVerticalIcon } from "@heroicons/react/24/solid";
import SettingsMenu from "./SettingsMenu";
import Button from "@/components/Button";

/*
interface RemoveVoteBtnProps {
id: number;
openMenu: (value: number) => void;
numberOfVotes: number;
closeMenu: () => void;
setIsEditing: Dispatch<SetStateAction<number>>;
isMenuOpen: number;
}
*/

export default function RemoveVoteBtn({
id,
openMenu,
numberOfVotes,
closeMenu,
setIsEditing,
isMenuOpen,
}: RemoveVoteBtnProps) {
const handleClick = () => {
openMenu(id);
};

export default function RemoveVoteBtn(
{
/* { id }: RemoveVoteBtnProps */
},
) {
return (
<div className="relative col-span-2 flex w-[165px] items-center justify-end">
{numberOfVotes < 2 && (
<div className="h-1/6 w-1/6">
<EllipsisVerticalIcon
className="mr-2 rounded-xl hover:cursor-pointer hover:bg-base-100"
onClick={handleClick}
/>
{isMenuOpen === id && (
<SettingsMenu
onClose={closeMenu}
setIsEditing={setIsEditing}
id={id}
/>
)}
</div>
)}
<Button
variant="error"
size="xs"
className="justify-self-end rounded-3xl font-semibold"
>
Remove Vote
</Button>
</div>
<Button
variant="error"
size="xs"
className="justify-self-end rounded-3xl font-semibold"
>
Remove Vote
</Button>
);
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,48 @@
"use client";
import { useEffect, useRef } from "react";
import { deleteTechItem } from "@/myVoyage/tech-stack/techStackService";
import { useAppDispatch } from "@/store/hooks";
import { onOpenModal } from "@/store/features/modal/modalSlice";
import EditMenu from "@/components/EditMenu";

interface SettingsMenuProps {
onClose: () => void;
setIsEditing: (value: number) => void;
setEditItemId: (value: number) => void;
id: number;
}

export default function SettingsMenu({
onClose,
setIsEditing,
setEditItemId,
id,
}: SettingsMenuProps) {
const dispatch = useAppDispatch();
const menuRef = useRef<HTMLDivElement>(null);

const openEdit = () => {
setIsEditing(id);
setEditItemId(id);
};

const handleDelete = () => {
dispatch(
onOpenModal({
type: "confirmation",
content: {
title: "Confirm Deletion",
message:
"Are you sure you want to delete? You will permanently lose all the information and will not be able to recover it.",
confirmationText: "Delete",
cancelText: "Keep It",
},
payload: {
params: {
techItemId: id,
},
redirect: null,
deleteFunction: deleteTechItem,
},
}),
);
};

useEffect(() => {
Expand All @@ -33,7 +59,7 @@ export default function SettingsMenu({

return (
<div className="absolute -mt-6 ml-[12px]" ref={menuRef}>
<EditMenu handleClick={openEdit} />
<EditMenu handleClick={openEdit} handleDelete={handleDelete} />
</div>
);
}
Loading
Loading