- Notifications
You must be signed in to change notification settings - Fork1.1k
feat: add support buttons#20339
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
b27a9cfdded442a5bc8df72925512c1e91fb0a7f3b4c95e480bd22b6b061909e91d0df62609a7900099cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -983,9 +983,10 @@ func DefaultSupportLinks(docsURL string) []LinkConfig { | ||
| Icon: "bug", | ||
| }, | ||
| { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. i guess we could make a new coder.com/chat link? or at least add a utm_source to the discord.gg url which i think the statistics do give us (unsure, need to check) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Thanks for flagging it! We can update the link in a follow up since I don't know who owns these links. | ||
| Name: "Join the Coder Discord", | ||
| Target: "https://discord.gg/coder", | ||
| Icon: "chat", | ||
| Location: "navbar", | ||
| }, | ||
| { | ||
| Name: "Star the Repo", | ||
| @@ -3325,7 +3326,9 @@ type SupportConfig struct { | ||
| type LinkConfig struct { | ||
| Name string `json:"name" yaml:"name"` | ||
| Target string `json:"target" yaml:"target"` | ||
| Icon string `json:"icon" yaml:"icon" enums:"bug,chat,docs,star"` | ||
| Location string `json:"location,omitempty" yaml:"location,omitempty" enums:"navbar,dropdown"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Just asking because it sounds like I'll be helping out more with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. mainly swagger generator + if we enable go validation, then the field will have restricted values too. | ||
| } | ||
| // Validate checks cross-field constraints for deployment values. | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -21,13 +21,14 @@ import { cn } from "utils/cn"; | ||
| import { DeploymentDropdown } from "./DeploymentDropdown"; | ||
| import { MobileMenu } from "./MobileMenu"; | ||
| import { ProxyMenu } from "./ProxyMenu"; | ||
| import { SupportIcon } from "./SupportIcon"; | ||
| import { UserDropdown } from "./UserDropdown/UserDropdown"; | ||
| interface NavbarViewProps { | ||
| logo_url?: string; | ||
| user: TypesGen.User; | ||
| buildInfo?: TypesGen.BuildInfoResponse; | ||
| supportLinks: readonly TypesGen.LinkConfig[]; | ||
| onSignOut: () => void; | ||
| canViewDeployment: boolean; | ||
| canViewOrganizations: boolean; | ||
| @@ -71,6 +72,16 @@ export const NavbarView: FC<NavbarViewProps> = ({ | ||
| <NavItems className="ml-4" user={user} /> | ||
| <div className="flex items-center gap-3 ml-auto"> | ||
| {supportLinks.filter(isNavbarLink).map((link) => ( | ||
| <div key={link.name} className="hidden md:block"> | ||
| <SupportButton | ||
| name={link.name} | ||
| target={link.target} | ||
| icon={link.icon} | ||
| /> | ||
| </div> | ||
| ))} | ||
| {proxyContextValue && ( | ||
| <div className="hidden md:block"> | ||
| <ProxyMenu proxyContextValue={proxyContextValue} /> | ||
| @@ -121,7 +132,7 @@ export const NavbarView: FC<NavbarViewProps> = ({ | ||
| <UserDropdown | ||
| user={user} | ||
| buildInfo={buildInfo} | ||
| supportLinks={supportLinks?.filter((link) => !isNavbarLink(link))} | ||
| onSignOut={onSignOut} | ||
| /> | ||
| </div> | ||
| @@ -240,3 +251,36 @@ const TasksNavItem: FC<TasksNavItemProps> = ({ user }) => { | ||
| function idleTasksLabel(count: number) { | ||
| return `You have ${count} ${count === 1 ? "task" : "tasks"} waiting for input`; | ||
| } | ||
| function isNavbarLink(link: TypesGen.LinkConfig): boolean { | ||
| return link.location === "navbar"; | ||
| } | ||
Parkreiner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| interface SupportButtonProps { | ||
| name: string; | ||
| target: string; | ||
| icon: string; | ||
| location?: string; | ||
| } | ||
| const SupportButton: FC<SupportButtonProps> = ({ name, target, icon }) => { | ||
| return ( | ||
| <Button asChild variant="outline"> | ||
| <a | ||
| href={target} | ||
| target="_blank" | ||
| rel="noreferrer" | ||
| className="inline-block" | ||
| > | ||
| {icon && ( | ||
| <SupportIcon | ||
| icon={icon} | ||
| className={"size-5 text-content-secondary"} | ||
| /> | ||
| )} | ||
| {name} | ||
| <span className="sr-only"> (link opens in new tab)</span> | ||
| </a> | ||
| </Button> | ||
| ); | ||
| }; | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.