Skip to content

Commit dfb67d6

Browse files
committed
Disable MyDay
1 parent 41cc75d commit dfb67d6

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

src/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const Features = {
2+
myDay: false,
3+
};

src/modules/projects/ProjectFactory.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ import ProjectModel, {
44
DEFAULT_PROJECTS,
55
IJsonProjectItem,
66
} from './models/ProjectModel';
7+
import { Features } from '../../config';
78

89
export default class ProjectFactory extends AbstractFactory {
910
createProjects(projectItems: IJsonProjectItem[]): ProjectModel[] {
10-
const hasMyDay = projectItems.find(
11-
(p) => p.key === DEFAULT_PROJECT_ID.MyDay
12-
);
13-
if (!hasMyDay) {
14-
const myDayProj = DEFAULT_PROJECTS.find(
11+
if (Features.myDay) {
12+
const hasMyDay = projectItems.find(
1513
(p) => p.key === DEFAULT_PROJECT_ID.MyDay
1614
);
17-
if (myDayProj) {
18-
projectItems.unshift(myDayProj);
15+
if (!hasMyDay) {
16+
const myDayProj = DEFAULT_PROJECTS.find(
17+
(p) => p.key === DEFAULT_PROJECT_ID.MyDay
18+
);
19+
if (myDayProj) {
20+
projectItems.unshift(myDayProj);
21+
}
1922
}
2023
}
2124

src/modules/projects/models/ProjectModel.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export enum DEFAULT_PROJECT_ID {
99
}
1010

1111
export const DEFAULT_PROJECTS: IJsonProjectItem[] = [
12-
{
13-
key: DEFAULT_PROJECT_ID.MyDay,
14-
title: 'My Day',
15-
color: colors.yellow.primary || '',
16-
deletable: false,
17-
expanded: false,
18-
},
12+
// {
13+
// key: DEFAULT_PROJECT_ID.MyDay,
14+
// title: 'My Day',
15+
// color: colors.yellow.primary || '',
16+
// deletable: false,
17+
// expanded: false,
18+
// },
1919
{
2020
key: DEFAULT_PROJECT_ID.Inbox,
2121
title: 'Inbox',
@@ -51,7 +51,7 @@ export default class ProjectModel extends AbstractModel
5151

5252
const newProps = {
5353
...props,
54-
children: props.children?.map((json) => new ProjectModel(json))
54+
children: props.children?.map((json) => new ProjectModel(json)),
5555
};
5656

5757
this.load(newProps);

src/screens/projects/components/TaskNode/TaskNode.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { createUseStyles } from 'react-jss';
1111
import TaskModel from '../../../../modules/tasks/models/TaskModel';
1212
import rootStore from '../../../../modules/RootStore';
1313
import * as TaskHooks from '../../../../hooks/TaskHooks';
14+
import { Features } from '../../../../config';
1415

1516
const { tasksStore } = rootStore;
1617

@@ -35,9 +36,11 @@ export default observer(function TaskNode({ task }: TaskNodeProps) {
3536
<span className={classes.taskTitle}>{task.title}</span>
3637
<span>{duration}</span>
3738
<span className={classes.taskNodeActions}>
38-
<EnterOutlined
39-
onClick={preventDefault(() => tasksStore.addToMyDay(task))}
40-
/>
39+
{Features.myDay && (
40+
<EnterOutlined
41+
onClick={preventDefault(() => tasksStore.addToMyDay(task))}
42+
/>
43+
)}
4144
{!task.active ? (
4245
<CaretRightFilled
4346
onClick={preventDefault(() => tasksStore.startTimer(task))}

0 commit comments

Comments
 (0)