Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/sidebarIndent #1001

Merged
merged 1 commit into from
Jul 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/gui/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class ReviewQueueListView extends ItemView {
public redraw(): void {
const activeFile: TFile | null = this.app.workspace.getActiveFile();

const rootEl: HTMLElement = createDiv("nav-folder mod-root");
const childrenEl: HTMLElement = rootEl.createDiv("nav-folder-children");
const rootEl: HTMLElement = createDiv();
const childrenEl: HTMLElement = rootEl;

for (const deckKey in this.plugin.reviewDecks) {
const deck: ReviewDeck = this.plugin.reviewDecks[deckKey];
Expand All @@ -57,7 +57,7 @@ export class ReviewQueueListView extends ItemView {
deckCollapsed,
false,
deck,
).getElementsByClassName("nav-folder-children")[0] as HTMLElement;
).getElementsByClassName("tree-item-children")[0] as HTMLElement;

if (deck.newNotes.length > 0) {
const newNotesFolderEl: HTMLElement = this.createRightPaneFolder(
Expand Down Expand Up @@ -154,19 +154,19 @@ export class ReviewQueueListView extends ItemView {
hidden: boolean,
deck: ReviewDeck,
): HTMLElement {
const folderEl: HTMLDivElement = parentEl.createDiv("nav-folder");
const folderTitleEl: HTMLDivElement = folderEl.createDiv("nav-folder-title");
const childrenEl: HTMLDivElement = folderEl.createDiv("nav-folder-children");
const folderEl: HTMLDivElement = parentEl.createDiv("tree-item");
const folderTitleEl: HTMLDivElement = folderEl.createDiv("tree-item-self");
const childrenEl: HTMLDivElement = folderEl.createDiv("tree-item-children");
const collapseIconEl: HTMLDivElement = folderTitleEl.createDiv(
"nav-folder-collapse-indicator collapse-icon",
"tree-item-collapse-indicator collapse-icon",
);

collapseIconEl.innerHTML = COLLAPSE_ICON;
if (collapsed) {
(collapseIconEl.childNodes[0] as HTMLElement).style.transform = "rotate(-90deg)";
}

folderTitleEl.createDiv("nav-folder-title-content").setText(folderTitle);
folderTitleEl.createDiv("tree-item-content").setText(folderTitle);

if (hidden) {
folderEl.style.display = "none";
Expand Down Expand Up @@ -199,18 +199,18 @@ export class ReviewQueueListView extends ItemView {
plugin: SRPlugin,
): void {
const navFileEl: HTMLElement = folderEl
.getElementsByClassName("nav-folder-children")[0]
.createDiv("nav-file");
.getElementsByClassName("tree-item-children")[0]
.createDiv("tree-item");
if (hidden) {
navFileEl.style.display = "none";
}

const navFileTitle: HTMLElement = navFileEl.createDiv("nav-file-title");
const navFileTitle: HTMLElement = navFileEl.createDiv("tree-item-self");
if (fileElActive) {
navFileTitle.addClass("is-active");
}

navFileTitle.createDiv("nav-file-title-content").setText(file.basename);
navFileTitle.createDiv("tree-item-content").setText(file.basename);
navFileTitle.addEventListener(
"click",
async (event: MouseEvent) => {
Expand Down Expand Up @@ -239,7 +239,7 @@ export class ReviewQueueListView extends ItemView {
}

private changeFolderIconToExpanded(folderEl: HTMLElement): void {
const collapseIconEl = folderEl.find("div.nav-folder-collapse-indicator");
const collapseIconEl = folderEl.find("div.tree-item-collapse-indicator");
(collapseIconEl.childNodes[0] as HTMLElement).style.transform = "";
}
}
Loading