Skip to content

Commit

Permalink
Changed API links to external
Browse files Browse the repository at this point in the history
  • Loading branch information
danyi1212 committed Nov 19, 2023
1 parent d2d083a commit abb8a53
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions frontend/src/components/settings/ServerInfoPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ import { formatBytes } from "@utils/FormatBytes"
import { formatSecondsDurationLong } from "@utils/FormatSecondsDurationLong"
import React, { useCallback, useEffect, useState } from "react"

interface LinkButtonProps {
href: string
children?: React.ReactNode
}

const LinkButton: React.FC<LinkButtonProps> = ({ href, children }) => (
<Button
component="a"
href={href}
target="_blank"
rel="noopener noreferrer"
variant="outlined"
color="secondary"
disabled={Boolean(import.meta.env.VITE_DEMO_MODE)}
>
{children}
</Button>
)

export const ServerInfoPanel: React.FC = () => {
const client = useClient()
const getServerInfo = useCallback(() => client.settings.getServerInfo(), [client])
Expand Down Expand Up @@ -135,12 +154,8 @@ export const ServerInfoPanel: React.FC = () => {
</Grid>
<Grid item xs={12}>
<Stack direction="row" justifyContent="space-around">
<Button component="a" href="/docs" variant="outlined" color="secondary">
API Explorer
</Button>
<Button component="a" href="/redoc" variant="outlined" color="secondary">
API Docs
</Button>
<LinkButton href="/docs">API Explorer</LinkButton>
<LinkButton href="/redoc">API Docs</LinkButton>
</Stack>
</Grid>
</Grid>
Expand Down

0 comments on commit abb8a53

Please sign in to comment.