Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 2038079

Browse files
committed
first commit
1 parent 9810e5a commit 2038079

File tree

6 files changed

+63
-1
lines changed

6 files changed

+63
-1
lines changed

src/components/Cell.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ export default function DefaultCell(cellProperties: Cell) {
190190
</CellContext.Provider>
191191
);
192192

193+
case DataTypes.TASK:
194+
return (
195+
<span ref={containerCellRef} className={`${c("md_cell")}`}></span>
196+
);
193197
/** Default option */
194198
default:
195199
LOGGER.warn(`Unknown data type: ${dataType}`);

src/components/Header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import HeaderMenu from "components/HeaderMenu";
88
import CalendarIcon from "components/img/CalendarIcon";
99
import MarkdownObsidian from "components/img/Markdown";
1010
import CalendarTimeIcon from "components/img/CalendarTime";
11+
import TaskIcon from "components/img/TaskIcon";
1112
import {
1213
ActionTypes,
1314
DataTypes,
@@ -90,9 +91,12 @@ export default function Header(headerProps: DatabaseHeaderProps) {
9091
propertyIcon = <CalendarTimeIcon />;
9192
break;
9293
case DataTypes.MARKDOWN:
93-
// TODO : add a markdown icon
9494
propertyIcon = <MarkdownObsidian />;
9595
break;
96+
case DataTypes.TASK:
97+
// TODO : add a markdown icon
98+
propertyIcon = <TaskIcon />;
99+
break;
96100
default:
97101
break;
98102
}

src/components/HeaderMenu.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { HeaderContext } from "components/contexts/HeaderContext";
2323
import { getColumnWidthStyle } from "components/styles/ColumnWidthStyle";
2424
import { ColumnModal } from "./modals/ColumnModal";
2525
import { HeaderMenuProps } from "cdm/HeaderModel";
26+
import TaskIcon from "components/img/TaskIcon";
2627

2728
const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
2829
/** state of width columns */
@@ -212,6 +213,19 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
212213
icon: <CalendarTimeIcon />,
213214
label: MetadataLabels.CALENDAR_TIME,
214215
},
216+
{
217+
onClick: (e: any) => {
218+
dispatch({
219+
type: ActionTypes.UPDATE_COLUMN_TYPE,
220+
columnId: column.id,
221+
dataType: DataTypes.TASK,
222+
});
223+
setShowType(false);
224+
setExpanded(false);
225+
},
226+
icon: <TaskIcon />,
227+
label: MetadataLabels.TASK,
228+
},
215229
];
216230

217231
const typePopper = usePopper(typeReferenceElement, typePopperElement, {

src/components/img/TaskIcon.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from "react";
2+
3+
export default function TaskIcon() {
4+
return (
5+
<svg
6+
width="24"
7+
height="24"
8+
viewBox="0 0 24 24"
9+
strokeWidth="2"
10+
stroke="currentColor"
11+
fill="none"
12+
strokeLinecap="round"
13+
strokeLinejoin="round"
14+
>
15+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
16+
<path d="M13 5h8" />
17+
<path d="M13 9h5" />
18+
<path d="M13 15h8" />
19+
<path d="M13 19h5" />
20+
<rect x="3" y="4" width="6" height="6" rx="1" />
21+
<rect x="3" y="14" width="6" height="6" rx="1" />
22+
</svg>
23+
);
24+
}

src/components/reducers/DatabaseDispatch.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,20 @@ export function databaseReducer(state: TableDataType, action: ActionType) {
210210
$set: parsedData,
211211
},
212212
});
213+
case DataTypes.TASK:
214+
return update(state, {
215+
skipReset: { $set: true },
216+
columns: {
217+
$set: [
218+
...state.columns.slice(0, typeIndex),
219+
{ ...state.columns[typeIndex], dataType: action.dataType },
220+
...state.columns.slice(typeIndex + 1, state.columns.length),
221+
],
222+
},
223+
data: {
224+
$set: parsedData,
225+
},
226+
});
213227
default:
214228
/**
215229
* GENERIC update change

src/helpers/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const DataTypes = Object.freeze({
2424
MARKDOWN: 'markdown',
2525
CALENDAR: 'calendar',
2626
CALENDAR_TIME: 'calendar_time',
27+
TASK: 'task',
2728
NEW_COLUMN: 'new_column'
2829
});
2930

@@ -43,6 +44,7 @@ export const MetadataLabels = Object.freeze({
4344
MODIFIED: 'Modified',
4445
CALENDAR: 'Date',
4546
CALENDAR_TIME: 'Datetime',
47+
TASK: 'Task',
4648
});
4749

4850
export const DEFAULT_COLUMN_CONFIG = Object.freeze({

0 commit comments

Comments
 (0)