mirror of
https://github.com/wassname/talk.git
synced 2026-08-09 12:30:42 +08:00
[CORL-132] Show version info (#2224)
* feat: show version info * fix: use version from talk-common/version
This commit is contained in:
@@ -7,3 +7,7 @@
|
||||
|
||||
.root {
|
||||
}
|
||||
|
||||
.logoContainer {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { AppBar, Begin, Divider, End } from "talk-ui/components/AppBar";
|
||||
import SignOutButtonContainer from "../containers/SignOutButtonContainer";
|
||||
import DecisionHistoryButton from "./DecisionHistoryButton";
|
||||
import Navigation from "./Navigation";
|
||||
import Version from "./Version";
|
||||
|
||||
import styles from "./App.css";
|
||||
|
||||
@@ -13,7 +14,10 @@ const App: StatelessComponent = ({ children }) => (
|
||||
<div className={styles.root}>
|
||||
<AppBar gutterBegin gutterEnd>
|
||||
<Begin itemGutter="double">
|
||||
<Logo />
|
||||
<div className={styles.logoContainer}>
|
||||
<Logo />
|
||||
<Version />
|
||||
</div>
|
||||
<Navigation />
|
||||
</Begin>
|
||||
<End>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
.version {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 22px;
|
||||
font-size: calc(10rem / var(--rem-base));
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import React, { StatelessComponent } from "react";
|
||||
|
||||
import { Typography } from "talk-ui/components";
|
||||
|
||||
import styles from "./Version.css";
|
||||
|
||||
const Version: StatelessComponent = () => {
|
||||
return (
|
||||
<Typography className={styles.version} variant="detail">
|
||||
{process.env.TALK_VERSION ? `v${process.env.TALK_VERSION}` : "Unknown"}
|
||||
</Typography>
|
||||
);
|
||||
};
|
||||
|
||||
export default Version;
|
||||
@@ -11,7 +11,12 @@ exports[`renders correctly 1`] = `
|
||||
<withPropsOnChange(Begin)
|
||||
itemGutter="double"
|
||||
>
|
||||
<withPropsOnChange(Logo) />
|
||||
<div
|
||||
className="App-logoContainer"
|
||||
>
|
||||
<withPropsOnChange(Logo) />
|
||||
<Version />
|
||||
</div>
|
||||
<Navigation />
|
||||
</withPropsOnChange(Begin)>
|
||||
<withPropsOnChange(End)>
|
||||
|
||||
@@ -10,6 +10,7 @@ import SignInWithFacebookContainer from "../containers/SignInWithFacebookContain
|
||||
import SignInWithGoogleContainer from "../containers/SignInWithGoogleContainer";
|
||||
import SignInWithOIDCContainer from "../containers/SignInWithOIDCContainer";
|
||||
import OrSeparator from "./OrSeparator";
|
||||
import Version from "./Version";
|
||||
|
||||
interface Props {
|
||||
error: string | null;
|
||||
@@ -33,28 +34,31 @@ const SignIn: StatelessComponent<Props> = ({
|
||||
const oneClickIntegrationEnabled =
|
||||
facebookEnabled || googleEnabled || oidcEnabled;
|
||||
return (
|
||||
<AuthBox
|
||||
title={
|
||||
<Localized id="login-signInTo">
|
||||
<span>Sign in to</span>
|
||||
</Localized>
|
||||
}
|
||||
>
|
||||
<HorizontalGutter size="oneAndAHalf">
|
||||
{error && (
|
||||
<CallOut color="error" fullWidth>
|
||||
{error}
|
||||
</CallOut>
|
||||
)}
|
||||
{emailEnabled && <SignInWithEmailContainer />}
|
||||
{emailEnabled && oneClickIntegrationEnabled && <OrSeparator />}
|
||||
<HorizontalGutter>
|
||||
{facebookEnabled && <SignInWithFacebookContainer auth={auth} />}
|
||||
{googleEnabled && <SignInWithGoogleContainer auth={auth} />}
|
||||
{oidcEnabled && <SignInWithOIDCContainer auth={auth} />}
|
||||
<>
|
||||
<AuthBox
|
||||
title={
|
||||
<Localized id="login-signInTo">
|
||||
<span>Sign in to</span>
|
||||
</Localized>
|
||||
}
|
||||
>
|
||||
<HorizontalGutter size="oneAndAHalf">
|
||||
{error && (
|
||||
<CallOut color="error" fullWidth>
|
||||
{error}
|
||||
</CallOut>
|
||||
)}
|
||||
{emailEnabled && <SignInWithEmailContainer />}
|
||||
{emailEnabled && oneClickIntegrationEnabled && <OrSeparator />}
|
||||
<HorizontalGutter>
|
||||
{facebookEnabled && <SignInWithFacebookContainer auth={auth} />}
|
||||
{googleEnabled && <SignInWithGoogleContainer auth={auth} />}
|
||||
{oidcEnabled && <SignInWithOIDCContainer auth={auth} />}
|
||||
</HorizontalGutter>
|
||||
</HorizontalGutter>
|
||||
</HorizontalGutter>
|
||||
</AuthBox>
|
||||
</AuthBox>
|
||||
<Version />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.version {
|
||||
width: 350px;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid var(--palette-grey-lighter);
|
||||
border-top: 0;
|
||||
padding: var(--spacing-unit);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import React, { StatelessComponent } from "react";
|
||||
|
||||
import { Flex, Typography } from "talk-ui/components";
|
||||
|
||||
import styles from "./Version.css";
|
||||
|
||||
const Version: StatelessComponent = () => {
|
||||
return (
|
||||
<Flex justifyContent="center">
|
||||
<Typography className={styles.version} variant="detail" align="center">
|
||||
{process.env.TALK_VERSION ? `v${process.env.TALK_VERSION}` : "Unknown"}
|
||||
</Typography>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
export default Version;
|
||||
+19
-16
@@ -1,21 +1,24 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders correctly 1`] = `
|
||||
<AuthBox
|
||||
title={
|
||||
<Localized
|
||||
id="login-signInTo"
|
||||
>
|
||||
<span>
|
||||
Sign in to
|
||||
</span>
|
||||
</Localized>
|
||||
}
|
||||
>
|
||||
<ForwardRef(forwardRef)
|
||||
size="oneAndAHalf"
|
||||
<React.Fragment>
|
||||
<AuthBox
|
||||
title={
|
||||
<Localized
|
||||
id="login-signInTo"
|
||||
>
|
||||
<span>
|
||||
Sign in to
|
||||
</span>
|
||||
</Localized>
|
||||
}
|
||||
>
|
||||
<ForwardRef(forwardRef) />
|
||||
</ForwardRef(forwardRef)>
|
||||
</AuthBox>
|
||||
<ForwardRef(forwardRef)
|
||||
size="oneAndAHalf"
|
||||
>
|
||||
<ForwardRef(forwardRef) />
|
||||
</ForwardRef(forwardRef)>
|
||||
</AuthBox>
|
||||
<Version />
|
||||
</React.Fragment>
|
||||
`;
|
||||
|
||||
@@ -526,6 +526,15 @@ exports[`renders sign in form 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="Flex-root Flex-flex Flex-justifyCenter"
|
||||
>
|
||||
<p
|
||||
className="Typography-root Typography-detail Typography-colorTextPrimary Typography-alignCenter Version-version"
|
||||
>
|
||||
vTest
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user