diff --git a/static/js/shop_components.jsx b/static/js/shop_components.jsx
index 8826632..c5142ea 100644
--- a/static/js/shop_components.jsx
+++ b/static/js/shop_components.jsx
@@ -7,9 +7,22 @@ import {useClickAway} from "@uidotdev/usehooks";
import {OverlayTrigger, Tooltip} from "react-bootstrap";
// https://stackoverflow.com/a/70511311
-const trueTypeOf = (obj) => Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
+const true_type_of = (obj) => Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
+function Tip({id, tip}) {
+ return (
+ {tip}}
+ >
+
+
+ );
+}
+
class Radio extends Component {
constructor(props) {
super(props);
@@ -37,22 +50,10 @@ class Radio extends Component {
return (
- {this.props.icon ?
![]({`/images${this.props.icon}`})
: null}
+ {this.props.icon &&
![]({`/images${this.props.icon}`})
}
{this.props.title}
- {
- this.props.tip ?
- (
- {this.props.tip}
-
- }>
-
- )
- :
- null
- }
+ {this.props.tip &&
}
{this.props.variants.map((variant, _) => (
);
@@ -169,24 +158,11 @@ class Line extends Component {
let key = this.props.id + this.props.outvar;
return (
-
- {
- this.props.tip ?
- (
- {this.props.tip}
-
- }>
-
- )
- :
- null
- }
+ {this.props.tip &&
}
@@ -247,22 +223,10 @@ class SwitchLine extends Component {
onChange={this.handleCheck}
/>
- {
- this.props.tip ?
- (
- {this.props.tip}
-
- }>
-
- )
- :
- null
- }
+ {this.props.tip && }
@@ -292,7 +256,7 @@ const componentsList = {
export function ProcessOptions({options, data, target, id}) {
- let options_t = trueTypeOf(options);
+ let options_t = true_type_of(options);
if (options_t === "array") {
return Array.from(
@@ -305,8 +269,8 @@ export function ProcessOptions({options, data, target, id}) {
);
} else if (options_t === "object") {
if (
- trueTypeOf(options.type) === "string" &&
- (trueTypeOf(options.args) === "object" || trueTypeOf(options.items) === "array")
+ true_type_of(options.type) === "string" &&
+ (true_type_of(options.args) === "object" || true_type_of(options.items) === "array")
) {
if (options.type in componentsList) {
return componentsList[options.type](target, id + options.type, data, options.args);
@@ -330,7 +294,7 @@ export function ProcessOptions({options, data, target, id}) {
}
export function FilterOptions(options, data) {
- let options_t = trueTypeOf(options);
+ let options_t = true_type_of(options);
let target = {};
if (options_t === "array") {
@@ -339,8 +303,8 @@ export function FilterOptions(options, data) {
});
} else if (options_t === "object") {
if (
- trueTypeOf(options.type) === "string" &&
- (trueTypeOf(options.args) === "object" || trueTypeOf(options.items) === "array")
+ true_type_of(options.type) === "string" &&
+ (true_type_of(options.args) === "object" || true_type_of(options.items) === "array")
) {
if (options.type in componentsList) {
target[options.args.outvar] = data[options.args.outvar];
@@ -443,7 +407,7 @@ export function OptionsSummaryPopup({id, options, data}) {
};
const stringify = (value) => {
- let value_type = trueTypeOf(value);
+ let value_type = true_type_of(value);
if (value_type === "string") {
return value;
} else if (value_type === "object") {