forked from apache/gravitino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[apache#4362] feat(web): Add GitHub stars and forks number for WebUI (a…
…pache#5567) ### What changes were proposed in this pull request? 1. Add GitHub image, stars icon and fork icon on the Navbar. 2. Send GET request to GitHub API to fetch the number of stars and forks and show on the Navbar 3. If the number of stars and forks more than 1000, it will show 1.x k. 4. Github image and stars icon can link to Gravitino repo, fork icon can link to Gravitino fork page. 5. Position version text next to Gravitino logo. ### Why are the changes needed? These change can improve user experience and efficiency. Fix: apache#4362 ### Does this PR introduce _any_ user-facing change? 1. Add Github image, stars icon and fork icon. 2. Position version text next to Gravitino logo. ### How was this patch tested? 1. Check the data was fetched from GitHub API. 2. console.log the number more than 1000, manual check it will change to 1.x k.  --------- Co-authored-by: Xun <[email protected]> Co-authored-by: Qian Xia <[email protected]>
- Loading branch information
1 parent
85e9918
commit af259c3
Showing
9 changed files
with
214 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,78 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import Link from 'next/link' | ||
import Image from 'next/image' | ||
import { Box, Typography } from '@mui/material' | ||
import { Star } from '@mui/icons-material' | ||
import { useAppSelector } from '@/lib/hooks/useStore' | ||
|
||
const GitHubInfo = () => { | ||
const githubUrl = 'https://github.com/apache/gravitino' | ||
const githubForkUrl = 'https://github.com/apache/gravitino/fork' | ||
const githubLogoUrl = (process.env.NEXT_PUBLIC_BASE_PATH ?? '') + '/icons/github-mark.svg' | ||
const forkLogoUrl = (process.env.NEXT_PUBLIC_BASE_PATH ?? '') + '/icons/git-fork.svg' | ||
const store = useAppSelector(state => state.sys) | ||
|
||
return ( | ||
<Box className={'twc-flex twc-gap-x-3 twc-bg-customs-lightBg twc-px-3 twc-py-2 twc-rounded-full'}> | ||
<Link href={githubUrl}> | ||
<Image | ||
className={'twc-align-middle'} | ||
src={githubLogoUrl} | ||
overrideSrc={githubLogoUrl} | ||
width={24} | ||
height={24} | ||
alt='logo' | ||
/> | ||
</Link> | ||
<Box className={'twc-flex twc-items-center twc-gap-x-3 twc-ml-2'}> | ||
<Link href={githubForkUrl} className={'twc-no-underline twc-bg-customs-dark twc-rounded-full '}> | ||
<Typography | ||
className={ | ||
'twc-flex twc-items-center twc-gap-2 twc-text-customs-black twc-px-2.5 twc-py-1 twc-text-[0.75rem] twc-font-bold' | ||
} | ||
> | ||
<Image | ||
className={'twc-align-middle twc-text-customs-white'} | ||
src={forkLogoUrl} | ||
overrideSrc={forkLogoUrl} | ||
width={24} | ||
height={24} | ||
alt='logo' | ||
/> | ||
{store.forks} Forks | ||
</Typography> | ||
</Link> | ||
<Link href={githubUrl} className={'twc-no-underline twc-bg-customs-dark twc-rounded-full '}> | ||
<Typography | ||
className={ | ||
'twc-flex twc-items-center twc-gap-2 twc-text-customs-black twc-px-2.5 twc-py-1 twc-text-[0.75rem] twc-font-bold' | ||
} | ||
> | ||
<Star className={'twc-text-customs-black'} /> | ||
{store.stars} Stars | ||
</Typography> | ||
</Link> | ||
</Box> | ||
</Box> | ||
) | ||
} | ||
|
||
export default GitHubInfo |
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,33 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { defHttp } from '@/lib/utils/axios' | ||
|
||
const githubApis = { | ||
GET: 'https://api.github.com/repos/apache/gravitino' | ||
} | ||
|
||
export const getGitHubApi = () => { | ||
return defHttp.get({ | ||
url: `${githubApis.GET}`, | ||
headers: { | ||
Accept: 'application/vnd.github+json' | ||
} | ||
}) | ||
} |
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