8000 feat: add feedback link to footer by Kira-Pilot · Pull Request #2447 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: add feedback link to footer #2447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Footer story
  • Loading branch information
Kira-Pilot committed Jun 17, 2022
commit a181dd5e88e3f1dfb68b846e9169e8151f1088a1
9 changes: 7 additions & 2 deletions site/src/components/AuthAndFrame/AuthAndFrame.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { makeStyles } from "@material-ui/core/styles"
import { FC } from "react"
import { useActor } from "@xstate/react"
import { FC, useContext } from "react"
import { XServiceContext } from "../../xServices/StateContext"
import { Footer } from "../Footer/Footer"
import { Navbar } from "../Navbar/Navbar"
import { RequireAuth } from "../RequireAuth/RequireAuth"
Expand All @@ -13,13 +15,16 @@ interface AuthAndFrameProps {
*/
export const AuthAndFrame: FC<AuthAndFrameProps> = ({ children }) => {
const styles = useStyles()
const xServices = useContext(XServiceContext)

const [buildInfoState] = useActor(xServices.buildInfoXService)

return (
<RequireAuth>
<div className={styles.site}>
<Navbar />
<div className={styles.siteContent}>{children}</div>
<Footer />
<Footer buildInfo={buildInfoState.context.buildInfo} />
</div>
</RequireAuth>
)
Expand Down
17 changes: 17 additions & 0 deletions site/src/components/Footer/Footer.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Story } from "@storybook/react"
import { Footer, FooterProps } from "./Footer"

export default {
title: "components/Footer",
component: Footer,
}

const Template: Story<FooterProps> = (args) => <Footer {...args} />

export const Example = Template.bind({})
Example.args = {
buildInfo: {
external_url: "",
version: "test-1.2.3",
},
}
26 changes: 10 additions & 16 deletions site/src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import Link from "@material-ui/core/Link"
import { makeStyles } from "@material-ui/core/styles"
import { useActor } from "@xstate/react"
import React, { useContext } from "react"
import * as TypesGen from "../../api/typesGenerated"
import { XServiceContext } from "../../xServices/StateContext"

export const Language = {
buildInfoText: (buildInfo: TypesGen.BuildInfoResponse): string => {
Expand All @@ -13,28 +10,25 @@ export const Language = {
reportBugLink: "Report an issue",
}

export const Footer: React.FC = ({ children }) => {
export interface FooterProps {
buildInfo?: TypesGen.BuildInfoResponse
}

export const Footer: React.FC<FooterProps> = ({ buildInfo }) => {
const styles = useFooterStyles()
const xServices = useContext(XServiceContext)
const [buildInfoState] = useActor(xServices.buildInfoXService)
const githubUrl = `https://github.com/coder/coder/issues/new?labels=bug,needs+grooming&title=Bug+in+${buildInfoState.context.buildInfo?.version}:&template=external_bug_report.md`

const githubUrl = `https://github.com/coder/coder/issues/new?labels=bug,needs+grooming&title=Bug+in+${buildInfo?.version}:&template=external_bug_report.md`

return (
<div className={styles.root}>
{children}
<Link className={styles.link} variant="caption" target="_blank" href={githubUrl}>
&#129714;&nbsp;{Language.reportBugLink}
</Link>
<div className={styles.copyRight}>{Language.copyrightText}</div>
{buildInfoState.context.buildInfo && (
{buildInfo && (
<div className={styles.buildInfo}>
<Link
className={styles.link}
variant="caption"
target="_blank"
href={buildInfoState.context.buildInfo.external_url}
>
{Language.buildInfoText(buildInfoState.context.buildInfo)}
<Link className={styles.link} variant="caption" target="_blank" href={buildInfo.external_url}>
{Language.buildInfoText(buildInfo)}
</Link>
</div>
)}
Expand Down
0