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

Feat: #200 프로젝트 생성 #240

Merged
merged 6 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 3 additions & 2 deletions src/components/common/DescriptionTextarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ export default function DescriptionTextarea({
const { register } = useFormContext();

return (
<label htmlFor={id}>
<label htmlFor={id} className="flex flex-col">
<h3 className="text-large">{label}</h3>
<textarea
id={id}
className="h-100 w-full rounded-md border border-input p-10 text-regular placeholder:text-xs"
className="w-full rounded-md border border-input p-10 text-regular placeholder:text-xs"
placeholder={placeholder}
rows={5}
ice-bear98 marked this conversation as resolved.
Show resolved Hide resolved
{...(validationRole ? register(fieldName, validationRole) : register(fieldName))}
/>
<div className={`my-5 h-10 text-xs text-error ${errors ? 'visible' : 'invisible'}`}>{errors}</div>
Expand Down
13 changes: 12 additions & 1 deletion src/pages/team/TeamPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useReadProjects, useDeleteProject } from '@hooks/query/useProjectQuery'
import Spinner from '@components/common/Spinner';
import { useReadTeams } from '@hooks/query/useTeamQuery';

import useToast from '@hooks/useToast';
import type { Project } from '@/types/ProjectType';

export default function TeamPage() {
Expand All @@ -18,6 +19,7 @@ export default function TeamPage() {
const { projectList: teamProjects, isProjectLoading } = useReadProjects(Number(teamId));
const { joinedTeamList, isLoading: isTeamLoading } = useReadTeams();
const [selectedProjectId, setSelectedProjectId] = useState<Project['projectId'] | null>(null);
const { toastWarn } = useToast();

const { mutate: deleteProjectMutate } = useDeleteProject(Number(teamId));

Expand All @@ -29,6 +31,11 @@ export default function TeamPage() {
openUpdateModal();
};

const handleCreateProjectClick = () => {
if (!teamId) return toastWarn('팀을 선택한 후 프로젝트 생성을 진행해주세요.');
openProjectModal();
};

const handleDeleteClick = (e: React.MouseEvent, projectId: Project['projectId']) => {
e.preventDefault();
deleteProjectMutate(projectId);
Expand All @@ -45,7 +52,11 @@ export default function TeamPage() {
<small className="text-xs font-bold text-category">team</small>
<span>{teamName}</span>
</div>
<button type="button" onClick={openProjectModal} className="mr-10 font-bold text-main hover:brightness-50">
<button
type="button"
onClick={handleCreateProjectClick}
className="mr-10 font-bold text-main hover:brightness-50"
>
ice-bear98 marked this conversation as resolved.
Show resolved Hide resolved
+ 프로젝트 생성
</button>
</header>
Expand Down