Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Change metas (title, favicon) for each page #231

Merged
merged 5 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"moment": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Install helmet

"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
Expand Down Expand Up @@ -51,6 +52,7 @@
]
},
"devDependencies": {
"@types/react-helmet": "^6.1.4",
"@types/react-router-dom": "^5.1.7",
"@typescript-eslint/eslint-plugin": "^4.28.4",
"@typescript-eslint/parser": "^4.28.4",
Expand Down
2 changes: 0 additions & 2 deletions ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand All @@ -24,7 +23,6 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Gitploy</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file added ui/public/spinner.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions ui/src/views/Deployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect } from "react"
import { Breadcrumb, PageHeader, Result } from "antd"
import { shallowEqual } from 'react-redux'
import { useParams } from "react-router-dom"
import { Helmet } from "react-helmet"

import { useAppSelector, useAppDispatch } from "../redux/hooks"
import {
Expand Down Expand Up @@ -127,6 +128,9 @@ export default function DeploymentView(): JSX.Element {

return (
<Main>
<Helmet>
<title>Deployment #{number} - {namespace}/{name}</title>
</Helmet>
<div>
<PageHeader
title={`Deployment #${number}`}
Expand Down
4 changes: 4 additions & 0 deletions ui/src/views/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect } from 'react'
import { shallowEqual } from 'react-redux'
import { Input, Breadcrumb } from 'antd'
import { Helmet } from "react-helmet"

import { useAppSelector, useAppDispatch } from '../redux/hooks'
import { homeSlice, listRepos, perPage, sync, homeSlice as slice } from '../redux/home'
Expand Down Expand Up @@ -74,6 +75,9 @@ export default function Home(): JSX.Element {

return (
<Main>
<Helmet>
<title>Home</title>
</Helmet>
<div >
<Breadcrumb>
<Breadcrumb.Item>
Expand Down
9 changes: 8 additions & 1 deletion ui/src/views/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"
import { shallowEqual } from "react-redux"
import { Layout, Menu, Row, Col, Result, Button, Drawer, Avatar, Dropdown, Badge} from "antd"
import { SettingFilled } from "@ant-design/icons"
import { Helmet } from "react-helmet"

import { useAppSelector, useAppDispatch } from "../redux/hooks"
import { init, searchDeployments, searchReviews, fetchLicense, mainSlice as slice } from "../redux/main"
Expand Down Expand Up @@ -92,6 +93,12 @@ export default function Main(props: any) {

return (
<Layout className="layout">
<Helmet>
<title>Gitploy</title>
{(deployments.length + reviews.length > 0)?
<link rel="icon" href="/spinner.ico" />:
<link rel="icon" href="/favicon.ico" />}
</Helmet>
<Header>
<Row>
<Col span="16">
Expand Down Expand Up @@ -135,7 +142,7 @@ export default function Main(props: any) {
</Menu.Item>
<Menu.Divider />
<Menu.Item key="1">
<a href="https://docs.gitploy.io/" target="_blank">Read Doc</a>
<a href="https://docs.gitploy.io/" target="_blank">Read Docs</a>
</Menu.Item>
<Menu.Item key="2">
<a href="/signout">Sign out</a>
Expand Down
52 changes: 29 additions & 23 deletions ui/src/views/Members.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect } from "react"
import { shallowEqual } from "react-redux"
import { Input } from "antd"
import { Helmet } from "react-helmet"

import { useAppSelector, useAppDispatch } from "../redux/hooks"
import { membersSlice as slice, fetchUsers, updateUser, deleteUser, perPage } from "../redux/members"
Expand Down Expand Up @@ -44,27 +45,32 @@ export default function Member(): JSX.Element {
dispatch(fetchUsers())
}

return <Main>
<div>
<h1>Members</h1>
</div>
<div style={{marginTop: "40px", paddingRight: "20px"}}>
<Search placeholder="Search user ..." onSearch={onSearch} enterButton />
</div>
<div style={{marginTop: "40px"}}>
<MemberList
users={users}
onChangeSwitch={onChangeSwitch}
onClickDelete={onClickDelete}
/>
</div>
<div style={{marginTop: "40px", textAlign: "center"}}>
<Pagination
page={page}
isLast={users.length !== perPage}
onClickPrev={onClickPrev}
onClickNext={onClickNext}
/>
</div>
</Main>
return (
<Main>
<Helmet>
<title>Members</title>
</Helmet>
<div>
<h1>Members</h1>
</div>
<div style={{marginTop: "40px", paddingRight: "20px"}}>
<Search placeholder="Search user ..." onSearch={onSearch} enterButton />
</div>
<div style={{marginTop: "40px"}}>
<MemberList
users={users}
onChangeSwitch={onChangeSwitch}
onClickDelete={onClickDelete}
/>
</div>
<div style={{marginTop: "40px", textAlign: "center"}}>
<Pagination
page={page}
isLast={users.length !== perPage}
onClickPrev={onClickPrev}
onClickNext={onClickNext}
/>
</div>
</Main>
)
}
4 changes: 4 additions & 0 deletions ui/src/views/Repo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useParams } from "react-router-dom";
import { Menu, Breadcrumb, Result, } from 'antd'
import { shallowEqual } from "react-redux";
import { useEffect } from "react";
import { Helmet } from "react-helmet"

import { useAppSelector, useAppDispatch } from '../redux/hooks'
import { init, activate, repoSlice as slice } from '../redux/repo'
Expand Down Expand Up @@ -68,6 +69,9 @@ export default function Repo(): JSX.Element {

return (
<Main>
<Helmet>
<title>{namespace}/{name}</title>
</Helmet>
<div >
<Breadcrumb>
<Breadcrumb.Item>
Expand Down
4 changes: 4 additions & 0 deletions ui/src/views/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Avatar, Button, Tag } from "antd"
import moment from "moment"
import { useEffect } from "react"
import { shallowEqual } from "react-redux"
import { Helmet } from "react-helmet"

import { useAppSelector, useAppDispatch } from "../redux/hooks"
import { fetchMe, fetchRateLimit,checkSlack } from "../redux/settings"
Expand All @@ -23,6 +24,9 @@ export default function Settings(): JSX.Element {

return (
<Main>
<Helmet>
<title>Settings</title>
</Helmet>
<div >
<h1>Settings</h1>
</div>
Expand Down