update
This commit is contained in:
20
main.ts
20
main.ts
@@ -8,7 +8,7 @@ import {
|
||||
import { ProjectView } from "./src/views/ProjectView";
|
||||
import { ProjectDetailsView } from "./src/views/ProjectDetailsView";
|
||||
import { CollectionView } from "./src/views/CollectionView";
|
||||
import { parseProjectFilePath } from "./src/fs";
|
||||
import { parseProjectFilePath, projectPathFromChain } from "./src/fs";
|
||||
import { BreadcrumbSegment, injectMobileBreadcrumb } from "./src/ui";
|
||||
|
||||
export default class ProjektkontextPlugin extends Plugin {
|
||||
@@ -63,7 +63,7 @@ export default class ProjektkontextPlugin extends Plugin {
|
||||
injectMobileBreadcrumb(view, []);
|
||||
return;
|
||||
}
|
||||
const loc = parseProjectFilePath(file.path);
|
||||
const loc = parseProjectFilePath(this.app, file.path);
|
||||
if (!loc) {
|
||||
injectMobileBreadcrumb(view, []);
|
||||
return;
|
||||
@@ -73,24 +73,28 @@ export default class ProjektkontextPlugin extends Plugin {
|
||||
label: "Projekte",
|
||||
onClick: () => void leaf.setViewState({ type: VIEW_TYPE_PROJECT_VIEW, active: true }),
|
||||
},
|
||||
{
|
||||
label: loc.project,
|
||||
];
|
||||
for (let i = 0; i < loc.projectChain.length; i++) {
|
||||
const projectPath = projectPathFromChain(loc.projectChain.slice(0, i + 1));
|
||||
segments.push({
|
||||
label: loc.projectChain[i],
|
||||
onClick: () =>
|
||||
void leaf.setViewState({
|
||||
type: VIEW_TYPE_PROJECT_DETAILS_VIEW,
|
||||
active: true,
|
||||
state: { project: loc.project },
|
||||
state: { projectPath },
|
||||
}),
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
if (loc.collection) {
|
||||
const projectPath = projectPathFromChain(loc.projectChain);
|
||||
segments.push({
|
||||
label: loc.collection,
|
||||
onClick: () =>
|
||||
void leaf.setViewState({
|
||||
type: VIEW_TYPE_COLLECTION_VIEW,
|
||||
active: true,
|
||||
state: { project: loc.project, collection: loc.collection, zone: loc.zone },
|
||||
state: { projectPath, collection: loc.collection },
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user