mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-16 09:13:36 +00:00
refactor: improve VersionUpgradeModal props and extract ReleaseInfo type
Using useVersionCheck hook in 2 places caused github requests to be made twice, which is not ideal.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { version } from '../../package.json';
|
||||
import { ReleaseInfo } from '../types/sharedTypes';
|
||||
|
||||
/**
|
||||
* Compare two semantic version strings
|
||||
@@ -20,13 +21,6 @@ const compareVersions = (v1: string, v2: string) => {
|
||||
return 0;
|
||||
};
|
||||
|
||||
type ReleaseInfo = {
|
||||
title: string;
|
||||
body: string;
|
||||
htmlUrl: string;
|
||||
publishedAt: string;
|
||||
};
|
||||
|
||||
export const useVersionCheck = (owner: string, repo: string) => {
|
||||
const [updateAvailable, setUpdateAvailable] = useState(false);
|
||||
const [latestVersion, setLatestVersion] = useState<string | null>(null);
|
||||
|
||||
Reference in New Issue
Block a user