aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes')
-rw-r--r--src/client/views/nodes/IconTagBox.tsx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/client/views/nodes/IconTagBox.tsx b/src/client/views/nodes/IconTagBox.tsx
index e076e691a..f86372ec0 100644
--- a/src/client/views/nodes/IconTagBox.tsx
+++ b/src/client/views/nodes/IconTagBox.tsx
@@ -1,3 +1,4 @@
+import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Tooltip } from '@mui/material';
import { computed } from 'mobx';
@@ -30,11 +31,11 @@ export class IconTagBox extends ObservableReactComponent<IconTagProps> {
return NumCast((this._props.doc.embedContainer as Doc)?._freeform_scale, 1);
}
- constructor(props: any) {
+ constructor(props: IconTagProps) {
super(props);
}
- componentDidUpdate(prevProps: Readonly<IconTagProps>): void {
+ componentDidUpdate(): void {
this._props.doc[DocData].tagHeight = 36 * this.currentScale;
}
@@ -52,7 +53,7 @@ export class IconTagBox extends ObservableReactComponent<IconTagProps> {
const totalWidth = (amButtons - 1) * 35 + (amButtons - 1) * 2 * 5 + 6;
const iconMap = (buttonID: number) => {
- return StrCast(Doc.UserDoc()[keys[buttonID]]);
+ return StrCast(Doc.UserDoc()[keys[buttonID]]) as IconProp;
};
const isCard = DocCast(this._props.doc.embedContainer).type_collection === CollectionViewType.Card;
@@ -69,7 +70,7 @@ export class IconTagBox extends ObservableReactComponent<IconTagProps> {
fontSize: '50px',
}}>
{numberRange(amButtons - 1).map(i => (
- <Tooltip key={i} title={<div className="dash-tooltip">Click to add/remove this card from the {iconMap(i)} group</div>}>
+ <Tooltip key={i} title={<div className="dash-tooltip">Click to add/remove this card from the {iconMap(i).toString()} group</div>}>
<button key={i} type="button" onClick={() => this.toggleButton(doc, iconMap(i))}>
{this.getButtonIcon(doc, iconMap(i))}
</button>
@@ -107,8 +108,8 @@ export class IconTagBox extends ObservableReactComponent<IconTagProps> {
* @param icon
* @returns
*/
- getButtonIcon = (doc: Doc, icon: any): JSX.Element => {
- const isActive = doc[icon];
+ getButtonIcon = (doc: Doc, icon: IconProp): JSX.Element => {
+ const isActive = doc[icon.toString()];
const color = isActive ? '#4476f7' : '#323232';
return <FontAwesomeIcon icon={icon} style={{ color, height: '30px', width: '30px' }} />;