Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 31b945a

Browse files
committed
syle compact adapted
1 parent 0b43311 commit 31b945a

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

src/components/HeaderMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { HeaderMenuProps } from "cdm/HeaderModel";
88
import header_action_button_section from "components/headerActions/HeaderActionButtonSection";
99
import { HeaderActionResponse } from "cdm/HeaderActionModel";
1010
import header_action_types_section from "components/headerActions/HeaderActiontypesSection";
11-
import { TableColumn } from "cdm/FolderModel";
11+
import { TableColumn, TableDataType } from "cdm/FolderModel";
1212

1313
const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
1414
const { table, header, column } = headerMenuProps.headerProps;
@@ -283,7 +283,7 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
283283
className="menu-item sort-button"
284284
onClick={() => {
285285
new ColumnModal(
286-
(table.options.meta as any).view,
286+
(table.options.meta as TableDataType).view,
287287
headerMenuProps
288288
).open();
289289
setExpanded(false);

src/components/modals/handlers/SelectedColumnOptionsHandler.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { randomColor } from "helpers/Colors";
66
import { ButtonComponent, Notice, Setting } from "obsidian";
77
import React from "react";
88
import ReactDOM from "react-dom";
9+
import { createRoot } from "react-dom/client";
910

1011
export class SelectedColumnOptionsHandler extends AbstractColumnHandler {
1112
settingTitle: string = "Column Options";
@@ -78,10 +79,8 @@ export class SelectedColumnOptionsHandler extends AbstractColumnHandler {
7879
columnSettingsManager.reset(columnHandlerResponse);
7980
});
8081
});
81-
82-
ReactDOM.render(
83-
<ColorPicker {...colorPickerProps} />,
84-
optionContainer.settingEl.createDiv()
82+
createRoot(optionContainer.settingEl.createDiv()).render(
83+
<ColorPicker {...colorPickerProps} />
8584
);
8685
});
8786

src/components/portals/TagsPortal.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ import { c } from "helpers/StylesHelper";
99
import { Literal } from "obsidian-dataview/lib/data-model/value";
1010
import { ActionTypes } from "helpers/Constants";
1111
import NoteInfo from "services/NoteInfo";
12-
import { TableColumn } from "cdm/FolderModel";
12+
import { TableColumn, TableDataType } from "cdm/FolderModel";
1313

1414
const TagsPortal = (tagsProps: TagsProps) => {
1515
const { intialState, column, dispatch, cellProperties, columns } = tagsProps;
16-
const { row } = cellProperties;
16+
const { row, table } = cellProperties;
1717
const tableColumn = column.columnDef as TableColumn;
18+
const state = table.options.meta as TableDataType;
1819
// Tags reference state
1920
const [showSelectTags, setShowSelectTags] = useState(false);
2021
// tags values state
@@ -36,16 +37,21 @@ const TagsPortal = (tagsProps: TagsProps) => {
3637
} else {
3738
// In case of new tag, generate random color
3839
const color = randomColor();
39-
dispatch({
40-
columns: columns,
41-
option: tag,
40+
const newOption: RowSelectOption = {
41+
label: tag,
4242
backgroundColor: color,
43-
columnId: column.id,
44-
type: ActionTypes.ADD_OPTION_TO_COLUMN,
43+
};
44+
const currentColumn = state.columns.find(
45+
(col: TableColumn) => col.key === tableColumn.key
46+
);
47+
currentColumn.options.push(newOption);
48+
state.view.diskConfig.updateColumnProperties(column.id, {
49+
options: currentColumn.options,
4550
});
4651
return color;
4752
}
4853
}
54+
4955
const defaultValue = tagsState.map((tag: string) => ({
5056
label: tag,
5157
value: tag,

src/helpers/SelectHelper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { OptionSelect } from "cdm/DatabaseModel";
22

33
export function obtainUniqueOptionValues(arrayOptions: OptionSelect[]): OptionSelect[] {
44
const uniqueValues: OptionSelect[] = [];
5-
arrayOptions.forEach(option => {
6-
if (!uniqueValues.some(unique => unique.label === option.label)) {
5+
// obtain unique values
6+
arrayOptions.forEach((option: OptionSelect) => {
7+
if (!uniqueValues.some((uniqueOption: OptionSelect) => uniqueOption.label === option.label)) {
78
uniqueValues.push(option);
89
}
910
});

0 commit comments

Comments
 (0)