feat: add social features, leaderboard, auth enhancements, and admin fixes
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
- Implement Social Features: Shared Tasks, Global Access, Privacy Settings (Leaderboard/Searchable). - Add Leaderboard Page and API. - Enhance Auth: Support Email/Username login, explicit duplicate registration errors. - Fix: Admin login password hash regression. - Refactor: Move to wouter for routing, add Admin Dashboard and User Management. - Add Setup Wizard. - Update UI with Sidebar and Gamification elements.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
export interface ParsedTask {
|
||||
title: string;
|
||||
priority?: 'low' | 'medium' | 'high';
|
||||
dueDate?: Date;
|
||||
labelName?: string;
|
||||
}
|
||||
|
||||
export const parseTaskInput = (input: string): ParsedTask => {
|
||||
let title = input;
|
||||
let priority: ParsedTask['priority'] | undefined;
|
||||
let dueDate: Date | undefined;
|
||||
let labelName: string | undefined;
|
||||
|
||||
// Parse Priority (!high, !medium, !low)
|
||||
const priorityMatch = title.match(/!(high|medium|low)/i);
|
||||
if (priorityMatch) {
|
||||
priority = priorityMatch[1].toLowerCase() as ParsedTask['priority'];
|
||||
title = title.replace(priorityMatch[0], '').trim();
|
||||
}
|
||||
|
||||
// Parse Label (#work, #personal)
|
||||
const labelMatch = title.match(/#(\w+)/);
|
||||
if (labelMatch) {
|
||||
labelName = labelMatch[1];
|
||||
title = title.replace(labelMatch[0], '').trim();
|
||||
}
|
||||
|
||||
// Parse Date (tomorrow, today, next friday) - Simple heuristic
|
||||
// Note: For production capability, use 'chrono-node'
|
||||
const today = new Date();
|
||||
const tomorrow = new Date(today);
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
|
||||
if (title.match(/\btomorrow\b/i)) {
|
||||
dueDate = tomorrow;
|
||||
title = title.replace(/\btomorrow\b/i, '').trim();
|
||||
} else if (title.match(/\btoday\b/i)) {
|
||||
dueDate = today;
|
||||
title = title.replace(/\btoday\b/i, '').trim();
|
||||
} else if (title.match(/\bnext week\b/i)) {
|
||||
const nextWeek = new Date(today);
|
||||
nextWeek.setDate(today.getDate() + 7);
|
||||
dueDate = nextWeek;
|
||||
title = title.replace(/\bnext week\b/i, '').trim();
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
priority,
|
||||
dueDate,
|
||||
labelName
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user