Let task links open a tab, and link the lead to inboxes for review
This commit is contained in:
Vendored
+6
-5
@@ -2,7 +2,7 @@ import { get, put, subscribe } from "./api.js";
|
||||
import { errorText, h, replace, showAlert } from "./dom.js";
|
||||
import { mountNavbar } from "./navbar.js";
|
||||
import { leadPane, taskPane } from "./panes.js";
|
||||
import { handleEvent, loadFocus, loadInbox, loadLeadSessions, loadMe, loadProjects, notify, on, selectTask, setFocus, startLeadStream, state } from "./state.js";
|
||||
import { handleEvent, loadFocus, loadInbox, loadLeadSessions, loadMe, loadProjects, notify, on, selectTask, setFocus, startLeadStream, state, tabs } from "./state.js";
|
||||
function identityBanner(root) {
|
||||
const render = () => {
|
||||
const me = state.me;
|
||||
@@ -31,12 +31,13 @@ function identityBanner(root) {
|
||||
render();
|
||||
}
|
||||
function route() {
|
||||
const match = /^#\/(task|project)\/(\w+)$/.exec(location.hash);
|
||||
const match = /^#\/(task|project)\/(\w+)(?:\/(\w+))?$/.exec(location.hash);
|
||||
const taskId = match?.[1] === "task" ? match[2] : undefined;
|
||||
const projectId = match?.[1] === "project" ? match[2] : undefined;
|
||||
const tab = tabs.find((t) => t === match?.[3]);
|
||||
if (taskId) {
|
||||
if (taskId !== state.focus.task_id) {
|
||||
setFocus({ task_id: taskId }).catch((err) => console.error("set focus", err));
|
||||
if (taskId !== state.focus.task_id || (tab && tab !== state.focus.tab)) {
|
||||
setFocus({ task_id: taskId, tab }).catch((err) => console.error("set focus", err));
|
||||
}
|
||||
}
|
||||
else if (state.focus.task_id || projectId !== state.focus.project_id) {
|
||||
@@ -53,7 +54,7 @@ async function main() {
|
||||
await Promise.all([loadMe(), loadProjects(), loadInbox(), loadLeadSessions()]);
|
||||
const linked = location.hash;
|
||||
await loadFocus();
|
||||
if (/^#\/(task|project)\/\w+$/.test(linked)) {
|
||||
if (/^#\/(task|project)\/\w+(\/\w+)?$/.test(linked)) {
|
||||
location.hash = linked;
|
||||
}
|
||||
startLeadStream();
|
||||
|
||||
Reference in New Issue
Block a user