Skip to content

Commit

Permalink
[lifeparticle#395] Fix some sonar cloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
panagiotisbellias authored and Panagiotis Bellias committed Apr 15, 2024
1 parent 34e9513 commit 22567e5
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 25 deletions.
1 change: 1 addition & 0 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#141414" />
<title></title>
</head>
<body>
<div id="root"></div>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/General/CodeEditor/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const CodeEditor: FC<CodeEditorProps> = ({
/>
</Form.Item>

<ValidateStatus status={status || ""} />
<ValidateStatus status={status ?? ""} />
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/Layouts/InputGrid/InputGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const InputGrid: FC<InputGridProps> = ({ children, className }) => {
return (
<Row gutter={[16, 0]} className={className}>
{childElements.map((child, index) => (
<Col key={index} xs={24} sm={24} md={24} lg={12}>
<Col key={child.id} xs={24} sm={24} md={24} lg={12}>
{child}
</Col>
))}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/Layouts/PageGrid/PageGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const PageGrid: FC<PageGridProps> = ({ children, className }) => {
return (
<Row gutter={[16, 16]} className={className}>
{childElements.map((child, index) => (
<Col key={index} xs={24} sm={24} md={24} lg={12}>
<Col key={child.id} xs={24} sm={24} md={24} lg={12}>
{child}
</Col>
))}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Colors/ColorPicker/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ColorPicker: FC = () => {

const [colorPickerRan, setColorPickerRan] = useState(false);
const [formatState, setFormatState] = useState(
searchParams.get(PARAMS.color) || ""
searchParams.get(PARAMS.color) ?? ""
);
const color = String(searchParams.get(PARAMS.color));
const format = String(searchParams.get(PARAMS.format)) as FormatType;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Colors/ShadesAndTints/components/Colors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Colors: FC<ExtendedColorsProps> = ({ colors, isPending, type }) => {
<div className={styles.colors__list}>
{colors.map((color, index) => (
<Card
key={index}
key={color.id}
style={{
backgroundColor: color,
color: getTextColor(color),
Expand Down
10 changes: 5 additions & 5 deletions ui/src/pages/Converter/Base64/Base64.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Base64: FC = () => {
},
async onChange(info) {
const { status, originFileObj, type } = info.file;
const text = (await originFileObj?.text()) || "";
const text = (await originFileObj?.text()) ?? "";
if (status === "done") {
if (type?.startsWith("image/")) {
handleImageUpload(
Expand Down Expand Up @@ -76,8 +76,8 @@ const Base64: FC = () => {
value={input}
language=" "
handleCode={(value) => {
setInput(value || "");
onClick("encode", value || "");
setInput(value ?? "");
onClick("encode", value ?? "");
}}
/>
<div className={style.base64__input}>
Expand All @@ -103,8 +103,8 @@ const Base64: FC = () => {
value={result}
language={" "}
handleCode={(value) => {
setResult(value || "");
onClick("decode", value || "");
setResult(value ?? "");
onClick("decode", value ?? "");
}}
/>
<div className={style.base64__output}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const JsonToTypescript: FC = () => {
label="Enter Json input"
language="json"
value={json}
handleCode={(value) => setJson(value || "")}
handleCode={(value) => setJson(value ?? "")}
status={status}
/>

Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/Generator/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Avatar = () => {
label="Font size"
placeholder="Enter font size"
value={fontSize}
onChange={(val) => setFontSize(val || 0)}
onChange={(val) => setFontSize(val ?? 0)}
type="number"
/>
</InputGrid>
Expand All @@ -111,7 +111,7 @@ const Avatar = () => {
label="Avatar size"
placeholder="Enter avatar size"
value={avatarSize}
onChange={(val) => setAvatarSize(val || 0)}
onChange={(val) => setAvatarSize(val ?? 0)}
type="number"
/>
<ResponsiveSegementWithLabel
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/Generator/CSharpBuilder/CSharpBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const CSharpBuilde: FC = () => {
value={input}
language="csharp"
handleCode={(value) => {
setInput(value || "");
onClick(value || "");
setInput(value ?? "");
onClick(value ?? "");
}}
/>

Expand Down
8 changes: 2 additions & 6 deletions ui/src/pages/Generator/Data/Data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ const DataGenerator: FC = () => {
style.dg__left__bottom__select
}
value={
dataTypes[k] === undefined
? ""
: dataTypes[k]
dataTypes[k] ?? ""
}
size="large"
options={[
Expand All @@ -199,9 +197,7 @@ const DataGenerator: FC = () => {
}
autoComplete="nope"
value={
colNames[k] === undefined
? ""
: colNames[k]
colNames[k] ?? ""
}
/>
))}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Information/Mimetype/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const MimeSearch: FC = () => {
const { searchParams, updateParamsValue } = useParamsValue({});

const [queryParams, setQueryParams] = useState(
searchParams.get(PARAMS.type) || ""
searchParams.get(PARAMS.type) ?? ""
);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Markdown/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const MarkdownEditor: FC = () => {
>
<MDEditor
value={markdown}
onChange={(value) => setMarkdown(value || "")}
onChange={(value) => setMarkdown(value ?? "")}
height="100%"
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Markdown/TableGenerator/TableGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const TableGenerator: FC = () => {
)}
<MDEditor
value={output}
onChange={(val) => setOutput(val || "")}
onChange={(val) => setOutput(val ?? "")}
height="100%"
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Tools/CodeFormatter/CodeFormatter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const CodeFormatter: FC = () => {

<CodeEditor
value={inputCode}
handleCode={(value) => setInputCode(value || "")}
handleCode={(value) => setInputCode(value ?? "")}
language={inputType}
label="Enter code"
/>
Expand Down

0 comments on commit 22567e5

Please sign in to comment.