diff --git a/apps/client/src/stylesheets/theme-next/shell.css b/apps/client/src/stylesheets/theme-next/shell.css index 2ae36db2a..e42ac2685 100644 --- a/apps/client/src/stylesheets/theme-next/shell.css +++ b/apps/client/src/stylesheets/theme-next/shell.css @@ -1428,9 +1428,7 @@ div.promoted-attribute-cell .tn-checkbox { height: 1cap; } -/* Relocate the checkbox before the label */ div.promoted-attribute-cell.promoted-attribute-label-boolean > div:first-of-type { - order: -1; margin-inline-end: 1.5em; } diff --git a/apps/client/src/widgets/PromotedAttributes.tsx b/apps/client/src/widgets/PromotedAttributes.tsx index b4e33d45c..9fca59704 100644 --- a/apps/client/src/widgets/PromotedAttributes.tsx +++ b/apps/client/src/widgets/PromotedAttributes.tsx @@ -115,10 +115,8 @@ function PromotedAttributeCell(props: CellProps) { return (
- {' '} -
- -
+ {definition.labelType !== "boolean" && } +
@@ -137,7 +135,7 @@ const LABEL_MAPPINGS: Record = { }; function LabelInput({ inputId, ...props }: CellProps & { inputId: string }) { - const { valueAttr, definition, definitionAttr } = props.cell; + const { valueName, valueAttr, definition, definitionAttr } = props.cell; const onChangeListener = buildPromotedAttributeChangedListener({...props}); const extraInputProps: InputHTMLAttributes = {}; @@ -165,39 +163,49 @@ function LabelInput({ inputId, ...props }: CellProps & { inputId: string }) { } } - return ( - <> - + const inputNode = ; - { definition.labelType === "color" && } - { definition.labelType === "url" && ( - { - const inputEl = document.getElementById(inputId) as HTMLInputElement | null; - const url = inputEl?.value; - if (url) { - window.open(url, "_blank"); - } - }} - /> - )} + if (definition.labelType === "boolean") { + return <> +
+ +
+ - ); + } else { + return ( +
+ {inputNode} + { definition.labelType === "color" && } + { definition.labelType === "url" && ( + { + const inputEl = document.getElementById(inputId) as HTMLInputElement | null; + const url = inputEl?.value; + if (url) { + window.open(url, "_blank"); + } + }} + /> + )} +
+ ); + } } diff --git a/apps/client/src/widgets/promoted_attributes.ts b/apps/client/src/widgets/promoted_attributes.ts index e440b7d90..074e2437f 100644 --- a/apps/client/src/widgets/promoted_attributes.ts +++ b/apps/client/src/widgets/promoted_attributes.ts @@ -1,18 +1,3 @@ -import { t } from "../services/i18n.js"; -import server from "../services/server.js"; -import ws from "../services/ws.js"; -import treeService from "../services/tree.js"; -import noteAutocompleteService from "../services/note_autocomplete.js"; -import NoteContextAwareWidget from "./note_context_aware_widget.js"; -import attributeService from "../services/attributes.js"; -import options from "../services/options.js"; -import utils from "../services/utils.js"; -import type FNote from "../entities/fnote.js"; -import type { Attribute } from "../services/attribute_parser.js"; -import type FAttribute from "../entities/fattribute.js"; -import type { EventData } from "../components/app_context.js"; - - export default class PromotedAttributesWidget extends NoteContextAwareWidget { async createPromotedAttributeCell(definitionAttr: FAttribute, valueAttr: Attribute, valueName: string) {