mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-02-15 13:17:32 +00:00
refactor: useVersionCheck.js to typescript
This commit is contained in:
@@ -8,7 +8,7 @@ import { version } from '../../package.json';
|
|||||||
* @param {string} v2
|
* @param {string} v2
|
||||||
* @returns positive if v1 > v2, negative if v1 < v2, 0 if equal
|
* @returns positive if v1 > v2, negative if v1 < v2, 0 if equal
|
||||||
*/
|
*/
|
||||||
const compareVersions = (v1, v2) => {
|
const compareVersions = (v1: string, v2: string) => {
|
||||||
const parts1 = v1.split('.').map(Number);
|
const parts1 = v1.split('.').map(Number);
|
||||||
const parts2 = v2.split('.').map(Number);
|
const parts2 = v2.split('.').map(Number);
|
||||||
|
|
||||||
@@ -20,11 +20,17 @@ const compareVersions = (v1, v2) => {
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ReleaseInfo = {
|
||||||
|
title: string;
|
||||||
|
body: string;
|
||||||
|
htmlUrl: string;
|
||||||
|
publishedAt: string;
|
||||||
|
};
|
||||||
|
|
||||||
export const useVersionCheck = (owner, repo) => {
|
export const useVersionCheck = (owner: string, repo: string) => {
|
||||||
const [updateAvailable, setUpdateAvailable] = useState(false);
|
const [updateAvailable, setUpdateAvailable] = useState(false);
|
||||||
const [latestVersion, setLatestVersion] = useState(null);
|
const [latestVersion, setLatestVersion] = useState<string | null>(null);
|
||||||
const [releaseInfo, setReleaseInfo] = useState(null);
|
const [releaseInfo, setReleaseInfo] = useState<ReleaseInfo | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const checkVersion = async () => {
|
const checkVersion = async () => {
|
||||||
Reference in New Issue
Block a user