Skip to content

Commit

Permalink
feat: create task while while in a date view will create task for tha…
Browse files Browse the repository at this point in the history
…t date
  • Loading branch information
vuvincent committed Nov 26, 2023
1 parent 9780b46 commit a952f85
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
4 changes: 3 additions & 1 deletion apps/desktop-v2/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ function Home() {
editingTask={
chosenTaskIndex !== -1
? memoizedTasksView[chosenTaskIndex]
: createBlankTask()
: createBlankTask({
startDate: viewingDate,
})
}
mode={chosenTaskIndex !== -1 ? "edit" : "create"}
onSubmit={handleCreateOrUpdateTask}
Expand Down
9 changes: 7 additions & 2 deletions apps/desktop-v2/app/view/inbox/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { settingsRoute } from "@/app/settings/meta";
import { AlertDialog } from "@/components/alert-dialog";
import { SupernovaCommandCenter } from "@/components/command-center";
import { CreateTaskPlaceholder } from "@/components/create-task-placeholder";
import { SupernovaGlobeLogoImage } from "@/components/icons";
import { InboxIcon, SupernovaGlobeLogoImage } from "@/components/icons";
import { Kbd } from "@/components/kbd";
import {
SupernovaTaskComponent,
Expand All @@ -16,6 +16,7 @@ import { withAuth } from "@/hocs/withAuth";
import useFetchTasks from "@/hooks/useFetchTasks";
import useShortcuts from "@/hooks/useShortcuts";
import useSupernovaTasksUI from "@/hooks/useSupernovaTasksUI";
import useViewingDateUI from "@/hooks/useViewingDate";
import { SupernovaCommand } from "@/types/command";
import { filterUnplannedTasks } from "@/utils/supernova-task";
import * as Accordion from "@radix-ui/react-accordion";
Expand All @@ -26,6 +27,7 @@ import { useMemo } from "react";
function Inbox() {
const { tasks, setTasks, taskFetchState, triggerRefetchTasks } =
useFetchTasks();
const { viewingDate } = useViewingDateUI();

const {
accordionValue,
Expand Down Expand Up @@ -120,7 +122,10 @@ function Inbox() {
)}
<SupernovaGlobeLogoImage width={30} height={30} priority />
<div className="flex items-center justify-center w-full">
<h4 className="text-[20px] font-semibold">Inbox</h4>
<h4 className="text-[20px] font-semibold inline-flex items-center gap-2">
<InboxIcon width={20} height={20} />
Inbox
</h4>
</div>
{taskFetchState.status === "loading" ? (
<div className="flex items-center gap-[10px]">
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop-v2/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const ArrowRightIcon = (props: ImageProps) => (
width={20}
height={20}
alt="Arrow Right"
priority
{...props}
/>
);
Expand Down Expand Up @@ -54,6 +55,7 @@ export const PlayGreenIcon = (props: ImageProps) => (
width={13}
height={13}
className="ml-[2px]"
priority
{...props}
/>
);
Expand All @@ -70,6 +72,7 @@ export const ClockCyanIcon = (props: ImageProps) => (
width={13}
height={13}
className="ml-[2px]"
priority
{...props}
/>
);
Expand All @@ -82,6 +85,7 @@ export const CalendarYellowIcon = (props: ImageProps) => (
width={13}
height={13}
alt="Calendar icon"
priority
{...props}
/>
);
Expand Down
5 changes: 4 additions & 1 deletion apps/desktop-v2/components/supernova-task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ const generateRandomID = () => {
/*
* Creates a blank task with a random ID
*/
export const createBlankTask = (): ISupernovaTask => {
export const createBlankTask = (args?: {
startDate?: Date;
}): ISupernovaTask => {
return {
id: generateRandomID(),
title: "",
isComplete: false,
originalBuildText: "",
createdAt: new Date(), // this is ignored in the backend, but for now just to satisfy the return arg
startDate: args?.startDate,
};
};

Expand Down
2 changes: 1 addition & 1 deletion apps/desktop-v2/components/task-builder-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// this is a task builder dialog which pops up in the center of the screen with an
// overlay
import React, { useCallback, useEffect, useMemo, useState } from "react";
import React, { useCallback, useEffect, useState } from "react";
import * as Dialog from "@radix-ui/react-dialog";
import { BaseEditor, Editor, Transforms, createEditor, NodeEntry } from "slate";
import {
Expand Down

1 comment on commit a952f85

@vercel
Copy link

@vercel vercel bot commented on a952f85 Nov 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.