-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
78 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.Touchable { | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react' | ||
import './Touchable.css' | ||
|
||
export interface TouchableProps extends React.HTMLAttributes<HTMLSpanElement> {} | ||
|
||
export const Touchable: React.FC<TouchableProps> = props => ( | ||
<span {...props} className={`Touchable ${props.className ?? ''}`} /> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {useEffect, useState} from 'react' | ||
import * as http from '../../common/http' | ||
import gt from 'semver/functions/gt' | ||
import pkg from '../../../package.json' | ||
|
||
export interface LatestRelease { | ||
tag_name: string // tag | ||
html_url: string // release 地址 | ||
body: string // 发布信息 | ||
} | ||
|
||
export function useLatestRelease() { | ||
const [latestVersion, setLatestVersion] = useState<LatestRelease>(null) | ||
|
||
useEffect(() => { | ||
http.share | ||
.get('https://api.github.com/repos/chenhb23/lanzouyun-disk/releases') | ||
.json<LatestRelease[]>() | ||
.then(value => { | ||
if (!value?.length) return | ||
|
||
if (gt(value[0].tag_name, pkg.version)) { | ||
setLatestVersion(value[0]) | ||
} | ||
}) | ||
}, []) | ||
|
||
return latestVersion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters