Browse Source

Add tagline to page title, update main header title

unoptim
GreatBearShark 2 years ago
parent
commit
7b2f598e60
  1. 1
      package.json
  2. 71
      src/components/main.tsx
  3. 17
      yarn.lock

1
package.json

@ -67,6 +67,7 @@
"qs": "^6.9.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-helmet": "^6.1.0",
"react-i18next": "^11.7.0",
"react-router-dom": "^5.2.0",
"reconnecting-websocket": "^4.4.0",

71
src/components/main.tsx

@ -1,6 +1,8 @@
import React, { Component, useEffect, useState } from 'react';
import { Link, RouteComponentProps, withRouter } from 'react-router-dom';
import { Subscription } from 'rxjs';
import { Helmet } from 'react-helmet';
import { retryWhen, delay, take } from 'rxjs/operators';
import useSWR from 'swr';
import {
@ -235,36 +237,47 @@ class Main extends Component<MainProps & RouteComponentProps, MainState> {
render() {
return (
<div className="container" style={{ maxWidth: '100%' }}>
<Header
title="Front Page"
subtitle={tagline}
details={{
[i18n.t('number_online_label')]: this.state.siteRes.online,
[i18n.t('members')]: this.state.siteRes.site.number_of_users,
}}
>
<Flex>
<Separator />
<Tooltip label={i18n.t('create_post')}>
<ResponsiveButton
as={StyledLink}
to="/create_post"
variant="primary"
mobileText={<Icon name="plus" />}
>
{i18n.t('create_post')}
</ResponsiveButton>
</Tooltip>
</Flex>
</Header>
<div className="row">
<main role="main" className="col-12 col-md-8">
{this.posts()}
</main>
<aside className="col-12 col-md-4 sidebar">{this.my_sidebar()}</aside>
<>
<div className="container" style={{ maxWidth: '100%' }}>
<Helmet>
<title>
{this.state.siteRes.site.name
? `${this.state.siteRes.site.name} - ${tagline}`
: tagline}
</title>
</Helmet>
<Header
title="Home"
subtitle={tagline}
details={{
[i18n.t('number_online_label')]: this.state.siteRes.online,
[i18n.t('members')]: this.state.siteRes.site.number_of_users,
}}
>
<Flex>
<Separator />
<Tooltip label={i18n.t('create_post')}>
<ResponsiveButton
as={StyledLink}
to="/create_post"
variant="primary"
mobileText={<Icon name="plus" />}
>
{i18n.t('create_post')}
</ResponsiveButton>
</Tooltip>
</Flex>
</Header>
<div className="row">
<main role="main" className="col-12 col-md-8">
{this.posts()}
</main>
<aside className="col-12 col-md-4 sidebar">
{this.my_sidebar()}
</aside>
</div>
</div>
</div>
</>
);
}

17
yarn.lock

@ -12405,7 +12405,7 @@ [email protected]^6.0.7:
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108"
integrity sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA==
[email protected]^3.0.1:
[email protected]^3.0.1, [email protected]^3.1.1:
version "3.2.0"
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
@ -12433,6 +12433,16 @@ [email protected]^1.0.2:
react-fast-compare "^3.0.1"
shallowequal "^1.1.0"
[email protected]^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726"
integrity sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw==
dependencies:
object-assign "^4.1.1"
prop-types "^15.7.2"
react-fast-compare "^3.1.1"
react-side-effect "^2.1.0"
[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/react-hotkeys/-/react-hotkeys-2.0.0.tgz#a7719c7340cbba888b0e9184f806a9ec0ac2c53f"
@ -12532,6 +12542,11 @@ [email protected]:
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
[email protected]^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.0.tgz#1ce4a8b4445168c487ed24dab886421f74d380d3"
integrity sha512-IgmcegOSi5SNX+2Snh1vqmF0Vg/CbkycU9XZbOHJlZ6kMzTmi3yc254oB1WCkgA7OQtIAoLmcSFuHTc/tlcqXg==
[email protected]^2.6.7:
version "2.6.12"
resolved "https://registry.yarnpkg.com/react-sizeme/-/react-sizeme-2.6.12.tgz#ed207be5476f4a85bf364e92042520499455453e"

Loading…
Cancel
Save