Skip to content

Commit

Permalink
Merge branch 'develop' into feat/#168/today-datBtn
Browse files Browse the repository at this point in the history
  • Loading branch information
seong-hui authored Jul 17, 2024
2 parents 56e3314 + 5a81120 commit 0618b68
Show file tree
Hide file tree
Showing 15 changed files with 332 additions and 105 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/gradle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ jobs:
node-version: '20'
cache: 'yarn'

- name: .env setting
run: |
echo "VITE_BASE_URL=${{ secrets.VITE_BASE_URL }}" >> .env
echo "VITE_GOOGLE_LOGIN_CLIENT_ID=${{ secrets.VITE_GOOGLE_LOGIN_CLIENT_ID }}" >> .env
- name: Install dependencies
run: yarn install --frozen-lockfile

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ dist-ssr
*.sw?

*storybook.log

.env
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"axios": "^1.7.2",
"fullcalendar": "^6.1.14",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
"react-datepicker": "^7.3.0",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.1",
Expand All @@ -41,6 +42,7 @@
"@storybook/test": "^8.1.11",
"@tanstack/eslint-plugin-query": "^5.51.1",
"@types/react": "^18.3.3",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-datepicker": "^6.2.0",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
Expand Down
1 change: 1 addition & 0 deletions src/components/DashboardPage/DashboardTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function DashboardTask({ text }: DashboardTaskProps) {
status={task.status}
deadLine={task.deadLine}
selectedTarget={selectedTarget}
preventDoubleClick
handleSelectedTarget={handleSelectedTarget}
iconType="active"
/>
Expand Down
36 changes: 33 additions & 3 deletions src/components/common/BtnTask/BtnTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface BtnTaskProps extends TaskType {
selectedTarget: TaskType | null;
iconType: 'stagingOrDelayed' | 'active';
btnStatus?: '진행중' | '미완료' | '완료' | '오늘로추가';
preventDoubleClick?: boolean;
isDragging?: boolean;
}

interface BorderColorProps {
Expand All @@ -25,11 +27,23 @@ interface BorderColorProps {
theme: Theme;
iconType: string;
status: string;
isDragging?: boolean;
}

function BtnTask(props: BtnTaskProps) {
const { id, name, deadLine, hasDescription, status, handleSelectedTarget, selectedTarget, iconType, btnStatus } =
props;
const {
id,
name,
deadLine,
hasDescription,
status,
handleSelectedTarget,
selectedTarget,
iconType,
btnStatus,
preventDoubleClick = false,
isDragging = false,
} = props;
const [isModalOpen, setModalOpen] = useState(false);
const [isHovered, setIsHovered] = useState(false);

Expand All @@ -46,6 +60,10 @@ function BtnTask(props: BtnTaskProps) {

/** 모달 띄우기 */
const handleDoubleClick = (e: React.MouseEvent) => {
if (preventDoubleClick) {
e.preventDefault();
return;
}
const rect = e.currentTarget.getBoundingClientRect();
const calculatedTop = rect.top;
const adjustedTop = Math.min(calculatedTop, MODAL.SCREEN_HEIGHT - MODAL.TASK_MODAL_HEIGHT);
Expand Down Expand Up @@ -85,6 +103,7 @@ function BtnTask(props: BtnTaskProps) {
onClick={handleClick}
theme={theme}
status={status}
isDragging={isDragging}
>
<BtnTaskContainer onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>
<BtnTaskTextWrapper isDescription={hasDescription}>
Expand All @@ -107,12 +126,23 @@ function BtnTask(props: BtnTaskProps) {

export default BtnTask;

const getBorderColor = ({ isHovered, isClicked, theme, status }: BorderColorProps) => {
const draggingStyle = (theme: Theme) => css`
background: ${theme.palette.Grey.White};
box-shadow: 0 16px 35px 0 rgb(72 87 120 / 25%);
border: 1px solid ${theme.palette.Blue.Blue7};
border-radius: 8px;
`;

const getBorderColor = ({ isHovered, isClicked, theme, status, isDragging }: BorderColorProps) => {
const defaultColor = theme.palette.Grey.Grey1;
const hoverColor = theme.palette.Blue.Blue3;
const clickColor = theme.palette.Primary;
const orangeColor = theme.palette.Orange.Orange8;
let borderColor = defaultColor;
if (isDragging && status !== '지연') {
return draggingStyle(theme);
}

if (status === '지연') {
borderColor = orangeColor;
} else if (isClicked) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/BtnTaskContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const BtnTaskContainer = styled.div<{ type: string }>`
display: flex;
flex-direction: column;
gap: 1rem;
width: 100%;
height: ${({ type }) => (type === 'staging' ? '56.7rem' : '64rem')};
width: 31.8rem;
height: ${({ type }) => (type === 'staging' ? '56rem' : '61rem')};
overflow: auto;
overflow-y: scroll;
Expand Down
3 changes: 2 additions & 1 deletion src/components/common/ScrollGradient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ function ScrollGradient() {
export default ScrollGradient;

const ScrollGradientLayout = styled.div`
position: sticky;
position: absolute;
bottom: 0;
left: 0;
z-index: 1;
display: flex;
flex-direction: column;
Expand Down
19 changes: 17 additions & 2 deletions src/components/common/StagingArea/StagingArea.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from '@emotion/styled';
import { Droppable } from 'react-beautiful-dnd';

import StagingAreaTaskContainer from './StagingAreaTaskContainer';

Expand All @@ -8,14 +9,27 @@ import { TaskType } from '@/types/tasks/taskType';
interface StagingAreaProps {
handleSelectedTarget: (task: TaskType | null) => void;
selectedTarget: TaskType | null;
tasks: TaskType[];
}
function StagingArea({ handleSelectedTarget, selectedTarget }: StagingAreaProps) {
function StagingArea(props: StagingAreaProps) {
const { handleSelectedTarget, selectedTarget, tasks } = props;
return (
<StagingAreaLayout>
<StagingAreaContainer>
<StagingAreaUpContainer>
<StagingAreaTitle>쏟아내기</StagingAreaTitle>
<StagingAreaTaskContainer handleSelectedTarget={handleSelectedTarget} selectedTarget={selectedTarget} />
<Droppable droppableId="staging">
{(provided) => (
<div ref={provided.innerRef} {...provided.droppableProps}>
<StagingAreaTaskContainer
handleSelectedTarget={handleSelectedTarget}
selectedTarget={selectedTarget}
tasks={tasks}
/>
{provided.placeholder}
</div>
)}
</Droppable>
</StagingAreaUpContainer>
<TextInputStaging />
</StagingAreaContainer>
Expand All @@ -26,6 +40,7 @@ function StagingArea({ handleSelectedTarget, selectedTarget }: StagingAreaProps)
export default StagingArea;

const StagingAreaLayout = styled.div`
position: relative;
display: inline-flex;
gap: 0.8rem;
align-items: center;
Expand Down
56 changes: 29 additions & 27 deletions src/components/common/StagingArea/StagingAreaTaskContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
import styled from '@emotion/styled';
import { Draggable } from 'react-beautiful-dnd';

import BtnTaskContainer from '../BtnTaskContainer';

import BtnTask from '@/components/common/BtnTask/BtnTask';
import ScrollGradient from '@/components/common/ScrollGradient';
import StagingAreaSetting from '@/components/common/StagingArea/StagingAreaSetting';
import { TaskType } from '@/types/tasks/taskType';

interface StagingAreaTaskContainerProps {
handleSelectedTarget: (task: TaskType | null) => void;
selectedTarget: TaskType | null;
tasks: TaskType[];
}
function StagingAreaTaskContainer({ handleSelectedTarget, selectedTarget }: StagingAreaTaskContainerProps) {
const dummyTaskList: TaskType[] = [
{
id: 3,
name: '김지원',
deadLine: {
date: '2024-06-30',
time: '12:30',
},
hasDescription: true,
status: '미완료',
},
];

function StagingAreaTaskContainer(props: StagingAreaTaskContainerProps) {
const { handleSelectedTarget, selectedTarget, tasks } = props;

return (
<StagingAreaTaskContainerLayout>
<StagingAreaSetting />
<BtnTaskContainer type="staging">
{dummyTaskList.map((task) => (
<BtnTask
key={task.id + task.name}
iconType="stagingOrDelayed"
hasDescription={task.hasDescription}
id={task.id}
name={task.name}
status={task.status}
deadLine={task.deadLine}
selectedTarget={selectedTarget}
handleSelectedTarget={handleSelectedTarget}
/>
{tasks.map((task, index) => (
<Draggable key={task.id} draggableId={task.id.toString()} index={index}>
{(provided, snapshot) => (
<div
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
style={{ userSelect: 'none', ...provided.draggableProps.style }}
>
<BtnTask
key={task.id + task.name}
iconType="stagingOrDelayed"
hasDescription={task.hasDescription}
id={task.id}
name={task.name}
status={task.status}
deadLine={task.deadLine}
selectedTarget={selectedTarget}
handleSelectedTarget={handleSelectedTarget}
isDragging={snapshot.isDragging}
/>
</div>
)}
</Draggable>
))}
<ScrollGradient />
</BtnTaskContainer>
</StagingAreaTaskContainerLayout>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/common/textbox/TextInputStaging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function TextInputStaging() {
}

const StagingLayout = styled.div`
position: absolute;
bottom: 2.8rem;
display: flex;
flex-direction: column;
justify-content: space-between;
Expand Down
19 changes: 17 additions & 2 deletions src/components/targetArea/TargetArea.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled from '@emotion/styled';
import { useState } from 'react';
import { Droppable } from 'react-beautiful-dnd';

import TargetAreaDate from './TargetAreaDate';
import TargetControlSection from './TargetControlSection';
Expand All @@ -10,8 +11,10 @@ import { TaskType } from '@/types/tasks/taskType';
interface TargetAreaProps {
handleSelectedTarget: (task: TaskType | null) => void;
selectedTarget: TaskType | null;
tasks: TaskType[];
}
function TargetArea({ handleSelectedTarget, selectedTarget }: TargetAreaProps) {

function TargetArea({ handleSelectedTarget, selectedTarget, tasks }: TargetAreaProps) {
const [targetDate, setTargetDate] = useState(new Date());

const handlePrevBtn = () => {
Expand Down Expand Up @@ -50,7 +53,18 @@ function TargetArea({ handleSelectedTarget, selectedTarget }: TargetAreaProps) {
targetDate={targetDate}
/>
{/* 태스크 목록 */}
<TargetTaskSection handleSelectedTarget={handleSelectedTarget} selectedTarget={selectedTarget} />
<Droppable droppableId="target">
{(provided) => (
<div ref={provided.innerRef} {...provided.droppableProps}>
<TargetTaskSection
handleSelectedTarget={handleSelectedTarget}
selectedTarget={selectedTarget}
tasks={tasks}
/>
{provided.placeholder}
</div>
)}
</Droppable>
</TargetAreaLayout>
);
}
Expand All @@ -59,6 +73,7 @@ const TargetAreaLayout = styled.section`
flex-direction: column;
flex-shrink: 0;
align-items: flex-start;
width: 31.8rem;
height: 74.8rem;
margin: 1rem;
padding: 0 0.1rem 0 0.7rem;
Expand Down
Loading

0 comments on commit 0618b68

Please sign in to comment.