This commit is contained in:
Team3
2026-05-19 22:02:32 +02:00
parent b98a998689
commit 2e8bf9599e
7 changed files with 317 additions and 259 deletions

20
main.ts
View File

@@ -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 },
}),
});
}