fix: minor issues

This commit is contained in:
abhijithvijayan
2026-01-04 04:03:25 +05:30
parent 0af9d929d5
commit d0673e2c0a
8 changed files with 27 additions and 19 deletions

View File

@@ -13,7 +13,7 @@ import {
useRequestStatus,
RequestStatusActionTypes,
} from '../contexts/request-status-context';
import messageUtil from '../util/mesageUtil';
import messageUtil from '../util/messageUtil';
import {FETCH_URLS_HISTORY} from '../Background/constants';
import {getExtensionSettings} from '../util/settings';
import {

View File

@@ -55,7 +55,7 @@ function Footer(): JSX.Element {
<div className={styles.linksSection}>
<a
href="https://kutt.it"
target="blank"
target="_blank"
rel="nofollow noopener noreferrer"
className={clsx(styles.linkItem, styles.narrow)}
>
@@ -63,8 +63,8 @@ function Footer(): JSX.Element {
</a>
<span className={styles.linkDivider} />
<a
href={'https://git.io/Jn5hS'}
target="blank"
href="https://git.io/Jn5hS"
target="_blank"
rel="nofollow noopener noreferrer"
className={clsx(styles.linkItem, styles.wide)}
>
@@ -73,7 +73,7 @@ function Footer(): JSX.Element {
<span className={styles.linkDivider} />
<a
href="https://github.com/thedevs-network/kutt-extension"
target="blank"
target="_blank"
rel="nofollow noopener noreferrer"
className={clsx(styles.linkItem, styles.narrow)}
>

View File

@@ -9,7 +9,7 @@ import {
clearExtensionSettings,
} from '../util/settings';
import {CHECK_API_KEY} from '../Background/constants';
import messageUtil from '../util/mesageUtil';
import messageUtil from '../util/messageUtil';
import {isValidUrl} from '../util/link';
import {
SuccessfulApiKeyCheckProperties,

View File

@@ -5,7 +5,7 @@ import clsx from 'clsx';
import {useExtensionSettings} from '../contexts/extension-settings-context';
import {SHORTEN_URL} from '../Background/constants';
import messageUtil from '../util/mesageUtil';
import messageUtil from '../util/messageUtil';
import {getCurrentTab} from '../util/tabs';
import {
RequestStatusActionTypes,
@@ -93,7 +93,7 @@ function Form(): JSX.Element {
const apiBody: ApiBodyProperties = {
apikey: extensionSettingsState.apikey,
target: target as unknown as string,
target: target!,
...(formState.customurl.trim() !== EMPTY_STRING && {
customurl: formState.customurl.trim(),
}),
@@ -149,7 +149,6 @@ function Form(): JSX.Element {
setFormState((prev) => {
return {...prev, customurl: url};
});
// ToDo: Remove special symbols
if (url.length > 0 && url.length < 3) {
setFormErrors((prev) => {
@@ -169,7 +168,6 @@ function Form(): JSX.Element {
setFormState((prev) => {
return {...prev, password};
});
// ToDo: Remove special symbols
if (password.length > 0 && password.length < 3) {
setFormErrors((prev) => {

View File

@@ -1,6 +1,6 @@
import {isNull, EMPTY_STRING} from '@abhijithvijayan/ts-utils';
import type {JSX} from 'react';
import {useState} from 'react';
import {useState, useRef, useEffect} from 'react';
import clsx from 'clsx';
import {openExtOptionsPage, openHistoryPage} from '../util/tabs';
@@ -10,7 +10,7 @@ import {
ExtensionSettingsActionTypes,
useExtensionSettings,
} from '../contexts/extension-settings-context';
import messageUtil from '../util/mesageUtil';
import messageUtil from '../util/messageUtil';
import {
SuccessfulApiKeyCheckProperties,
AuthRequestBodyProperties,
@@ -29,6 +29,17 @@ function Header(): JSX.Element {
error: null,
message: EMPTY_STRING,
});
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
// Cleanup timer on unmount
useEffect(
() => (): void => {
if (timerRef.current) {
clearTimeout(timerRef.current);
}
},
[]
);
async function fetchUserDomains(): Promise<void> {
setLoading(true);
@@ -57,7 +68,11 @@ function Header(): JSX.Element {
payload: !extensionSettingsState.reload,
});
setTimeout(() => {
// Clear any existing timer before setting a new one
if (timerRef.current) {
clearTimeout(timerRef.current);
}
timerRef.current = setTimeout(() => {
setErrored({error: null, message: EMPTY_STRING});
}, 1000);
}

View File

@@ -10,11 +10,6 @@ import Icon from '../components/Icon';
import styles from './ResponseBody.module.scss';
export type ProcessedRequestProperties = {
error: boolean | null;
message: string;
};
function ResponseBody(): JSX.Element {
const [{error, message}] = useRequestStatus();
const [copied, setCopied] = useState<boolean>(false);

View File

@@ -5,7 +5,7 @@ import {UserShortenedLinkStats} from '../Background';
export enum ShortenedLinksActionTypes {
HYDRATE_SHORTENED_LINKS = 'hydrate-shortened-links',
SET_CURRENT_SELECTED = 'toggle-qrcode-modal',
SET_CURRENT_SELECTED = 'set-current-selected',
}
type HYDRATE_SHORTENED_LINKS = {