floq 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +12 -1
- package/README.md +12 -1
- package/dist/cli.js +24 -0
- package/dist/commands/add.d.ts +1 -0
- package/dist/commands/add.js +2 -0
- package/dist/commands/context.d.ts +3 -0
- package/dist/commands/context.js +36 -0
- package/dist/commands/list.js +17 -5
- package/dist/config.d.ts +4 -0
- package/dist/config.js +25 -0
- package/dist/db/index.js +16 -0
- package/dist/db/schema.d.ts +19 -0
- package/dist/db/schema.js +1 -0
- package/dist/i18n/en.d.ts +44 -0
- package/dist/i18n/en.js +26 -0
- package/dist/i18n/ja.js +26 -0
- package/dist/ui/App.js +187 -13
- package/dist/ui/components/KanbanBoard.js +173 -16
- package/dist/ui/components/SearchResults.d.ts +2 -1
- package/dist/ui/components/SearchResults.js +22 -2
- package/dist/ui/components/TaskItem.js +1 -1
- package/dist/ui/history/commands/SetContextCommand.d.ts +20 -0
- package/dist/ui/history/commands/SetContextCommand.js +37 -0
- package/dist/ui/history/commands/index.d.ts +1 -0
- package/dist/ui/history/commands/index.js +1 -0
- package/dist/ui/history/index.d.ts +1 -1
- package/dist/ui/history/index.js +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ interface SearchResultsProps {
|
|
|
4
4
|
results: Task[];
|
|
5
5
|
selectedIndex: number;
|
|
6
6
|
query: string;
|
|
7
|
+
viewMode?: 'gtd' | 'kanban';
|
|
7
8
|
}
|
|
8
|
-
export declare function SearchResults({ results, selectedIndex, query }: SearchResultsProps): React.ReactElement;
|
|
9
|
+
export declare function SearchResults({ results, selectedIndex, query, viewMode }: SearchResultsProps): React.ReactElement;
|
|
9
10
|
export {};
|
|
@@ -2,7 +2,17 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
3
|
import { t } from '../../i18n/index.js';
|
|
4
4
|
import { useTheme } from '../theme/index.js';
|
|
5
|
-
|
|
5
|
+
// Map GTD status to Kanban column
|
|
6
|
+
function getKanbanColumn(status) {
|
|
7
|
+
if (status === 'inbox' || status === 'someday') {
|
|
8
|
+
return 'todo';
|
|
9
|
+
}
|
|
10
|
+
if (status === 'next' || status === 'waiting') {
|
|
11
|
+
return 'doing';
|
|
12
|
+
}
|
|
13
|
+
return 'done';
|
|
14
|
+
}
|
|
15
|
+
export function SearchResults({ results, selectedIndex, query, viewMode = 'gtd' }) {
|
|
6
16
|
const i18n = t();
|
|
7
17
|
const theme = useTheme();
|
|
8
18
|
const search = i18n.tui.search;
|
|
@@ -12,7 +22,17 @@ export function SearchResults({ results, selectedIndex, query }) {
|
|
|
12
22
|
return (_jsxs(Box, { flexDirection: "column", borderStyle: theme.borders.list, borderColor: theme.colors.borderActive, paddingX: 1, paddingY: 1, minHeight: 5, children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: theme.colors.secondary, bold: true, children: ["[", search.resultsTitle, "] (", results.length, ")"] }) }), results.length === 0 ? (_jsx(Text, { color: theme.colors.textMuted, italic: true, children: search.noResults })) : (results.slice(0, 10).map((task, index) => {
|
|
13
23
|
const isSelected = index === selectedIndex;
|
|
14
24
|
const shortId = task.id.slice(0, 8);
|
|
15
|
-
|
|
25
|
+
let displayLabel;
|
|
26
|
+
if (task.isProject) {
|
|
27
|
+
displayLabel = i18n.tui.keyBar.project;
|
|
28
|
+
}
|
|
29
|
+
else if (viewMode === 'kanban') {
|
|
30
|
+
const kanbanColumn = getKanbanColumn(task.status);
|
|
31
|
+
displayLabel = i18n.kanban[kanbanColumn];
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
displayLabel = i18n.status[task.status];
|
|
35
|
+
}
|
|
16
36
|
return (_jsx(Box, { children: _jsxs(Text, { color: isSelected ? theme.colors.textSelected : theme.colors.text, bold: isSelected, children: [isSelected ? theme.style.selectedPrefix : theme.style.unselectedPrefix, "[", shortId, "] ", task.title, _jsxs(Text, { color: theme.colors.textMuted, children: [" (", displayLabel, ")"] }), task.waitingFor && (_jsxs(Text, { color: theme.colors.statusWaiting, children: [" - ", task.waitingFor] }))] }) }, task.id));
|
|
17
37
|
})), results.length > 10 && (_jsxs(Text, { color: theme.colors.textMuted, italic: true, children: ["... and ", results.length - 10, " more"] }))] }));
|
|
18
38
|
}
|
|
@@ -7,5 +7,5 @@ export function TaskItem({ task, isSelected, projectName, progress }) {
|
|
|
7
7
|
const shortId = task.id.slice(0, 8);
|
|
8
8
|
const i18n = t();
|
|
9
9
|
const theme = useTheme();
|
|
10
|
-
return (_jsx(Box, { children: _jsxs(Text, { color: isSelected ? theme.colors.textSelected : theme.colors.text, bold: isSelected, children: [isSelected ? theme.style.selectedPrefix : theme.style.unselectedPrefix, "[", shortId, "] ", task.title, projectName && (_jsxs(Text, { color: theme.colors.statusSomeday, children: ["
|
|
10
|
+
return (_jsx(Box, { children: _jsxs(Text, { color: isSelected ? theme.colors.textSelected : theme.colors.text, bold: isSelected, children: [isSelected ? theme.style.selectedPrefix : theme.style.unselectedPrefix, "[", shortId, "] ", task.title, task.context && (_jsxs(Text, { color: theme.colors.accent, children: [" @", task.context] })), projectName && (_jsxs(Text, { color: theme.colors.statusSomeday, children: [" [", projectName, "]"] })), progress && progress.total > 0 && (_jsx(ProgressBar, { completed: progress.completed, total: progress.total })), task.waitingFor && (_jsxs(Text, { color: theme.colors.statusWaiting, children: [" (", i18n.status.waiting.toLowerCase(), ": ", task.waitingFor, ")"] })), task.dueDate && (_jsxs(Text, { color: theme.colors.accent, children: [" (due: ", task.dueDate.toLocaleDateString(), ")"] }))] }) }));
|
|
11
11
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UndoableCommand } from '../types.js';
|
|
2
|
+
interface SetContextParams {
|
|
3
|
+
taskId: string;
|
|
4
|
+
fromContext: string | null;
|
|
5
|
+
toContext: string | null;
|
|
6
|
+
description: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Command to set/change a task's context
|
|
10
|
+
*/
|
|
11
|
+
export declare class SetContextCommand implements UndoableCommand {
|
|
12
|
+
readonly description: string;
|
|
13
|
+
private readonly taskId;
|
|
14
|
+
private readonly fromContext;
|
|
15
|
+
private readonly toContext;
|
|
16
|
+
constructor(params: SetContextParams);
|
|
17
|
+
execute(): Promise<void>;
|
|
18
|
+
undo(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
import { getDb, schema } from '../../../db/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Command to set/change a task's context
|
|
5
|
+
*/
|
|
6
|
+
export class SetContextCommand {
|
|
7
|
+
description;
|
|
8
|
+
taskId;
|
|
9
|
+
fromContext;
|
|
10
|
+
toContext;
|
|
11
|
+
constructor(params) {
|
|
12
|
+
this.taskId = params.taskId;
|
|
13
|
+
this.fromContext = params.fromContext;
|
|
14
|
+
this.toContext = params.toContext;
|
|
15
|
+
this.description = params.description;
|
|
16
|
+
}
|
|
17
|
+
async execute() {
|
|
18
|
+
const db = getDb();
|
|
19
|
+
await db
|
|
20
|
+
.update(schema.tasks)
|
|
21
|
+
.set({
|
|
22
|
+
context: this.toContext,
|
|
23
|
+
updatedAt: new Date(),
|
|
24
|
+
})
|
|
25
|
+
.where(eq(schema.tasks.id, this.taskId));
|
|
26
|
+
}
|
|
27
|
+
async undo() {
|
|
28
|
+
const db = getDb();
|
|
29
|
+
await db
|
|
30
|
+
.update(schema.tasks)
|
|
31
|
+
.set({
|
|
32
|
+
context: this.fromContext,
|
|
33
|
+
updatedAt: new Date(),
|
|
34
|
+
})
|
|
35
|
+
.where(eq(schema.tasks.id, this.taskId));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -5,3 +5,4 @@ export { LinkTaskCommand } from './LinkTaskCommand.js';
|
|
|
5
5
|
export { ConvertToProjectCommand } from './ConvertToProjectCommand.js';
|
|
6
6
|
export { CreateCommentCommand } from './CreateCommentCommand.js';
|
|
7
7
|
export { DeleteCommentCommand } from './DeleteCommentCommand.js';
|
|
8
|
+
export { SetContextCommand } from './SetContextCommand.js';
|
|
@@ -5,3 +5,4 @@ export { LinkTaskCommand } from './LinkTaskCommand.js';
|
|
|
5
5
|
export { ConvertToProjectCommand } from './ConvertToProjectCommand.js';
|
|
6
6
|
export { CreateCommentCommand } from './CreateCommentCommand.js';
|
|
7
7
|
export { DeleteCommentCommand } from './DeleteCommentCommand.js';
|
|
8
|
+
export { SetContextCommand } from './SetContextCommand.js';
|
|
@@ -3,4 +3,4 @@ export { MAX_HISTORY_SIZE } from './types.js';
|
|
|
3
3
|
export { HistoryManager, getHistoryManager } from './HistoryManager.js';
|
|
4
4
|
export { HistoryProvider, useHistoryContext } from './HistoryContext.js';
|
|
5
5
|
export { useHistory } from './useHistory.js';
|
|
6
|
-
export { CreateTaskCommand, DeleteTaskCommand, MoveTaskCommand, LinkTaskCommand, ConvertToProjectCommand, CreateCommentCommand, DeleteCommentCommand, } from './commands/index.js';
|
|
6
|
+
export { CreateTaskCommand, DeleteTaskCommand, MoveTaskCommand, LinkTaskCommand, ConvertToProjectCommand, CreateCommentCommand, DeleteCommentCommand, SetContextCommand, } from './commands/index.js';
|
package/dist/ui/history/index.js
CHANGED
|
@@ -5,4 +5,4 @@ export { HistoryManager, getHistoryManager } from './HistoryManager.js';
|
|
|
5
5
|
export { HistoryProvider, useHistoryContext } from './HistoryContext.js';
|
|
6
6
|
export { useHistory } from './useHistory.js';
|
|
7
7
|
// Commands
|
|
8
|
-
export { CreateTaskCommand, DeleteTaskCommand, MoveTaskCommand, LinkTaskCommand, ConvertToProjectCommand, CreateCommentCommand, DeleteCommentCommand, } from './commands/index.js';
|
|
8
|
+
export { CreateTaskCommand, DeleteTaskCommand, MoveTaskCommand, LinkTaskCommand, ConvertToProjectCommand, CreateCommentCommand, DeleteCommentCommand, SetContextCommand, } from './commands/index.js';
|