Skip to content
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

feat: Use IconButton to report issues #179

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/components/Layout/ActivityBar/ActivityBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export function ActivityBar() {
/>
</Grid>

<Box mt="auto">
<Flex direction="column" align="center" gap="3" mt="auto">
<ThemeSwitcher />
</Box>
<VersionLabel />
<VersionLabel />
</Flex>
</Box>
</Flex>
)
Expand Down
58 changes: 30 additions & 28 deletions src/components/Layout/ActivityBar/VersionLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
import { Code, Flex, Tooltip, Link, Text } from '@radix-ui/themes'
import { ChatBubbleIcon } from '@radix-ui/react-icons'
import { Code, Flex, Tooltip, IconButton } from '@radix-ui/themes'

export function VersionLabel() {
const handleReportIssue = (event: React.MouseEvent<HTMLAnchorElement>) => {
event.preventDefault()
const handleReportIssue = () => {
window.studio.browser.openExternalLink(
'https://github.com/grafana/k6-studio/issues'
)
}

return (
<Tooltip
content={
<>
This is an alpha version of k6 Studio.
<br />
Please report any issues you encounter.
</>
}
>
<Flex direction="column" gap="1" align="center">
<Code size="1" variant="ghost" color="gray">
v{__APP_VERSION__}
</Code>

<Code size="1" variant="ghost" color="gray">
alpha
</Code>

<Text align="center" size="1">
<Link href="" onClick={handleReportIssue}>
Report issues
</Link>
</Text>
</Flex>
</Tooltip>
<>
<Tooltip content="Report an issue" side="right">
<IconButton
are-label="Report an issue"
color="gray"
variant="ghost"
onClick={handleReportIssue}
>
<ChatBubbleIcon />
</IconButton>
</Tooltip>
<Tooltip
content={
<>
This is an experimental version of k6 Studio.
<br />
Please report any issues you encounter.
</>
}
>
<Flex direction="column" gap="1" align="center">
<Code size="1" variant="ghost" color="gray">
v{__APP_VERSION__.split('-').join('')}
</Code>
</Flex>
</Tooltip>
</>
)
}
15 changes: 11 additions & 4 deletions src/components/ThemeSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTheme } from '@/hooks/useTheme'
import { MoonIcon, SunIcon } from '@radix-ui/react-icons'
import { IconButton } from '@radix-ui/themes'
import { IconButton, Tooltip } from '@radix-ui/themes'

export function ThemeSwitcher() {
const theme = useTheme()
Expand All @@ -10,8 +10,15 @@ export function ThemeSwitcher() {
}

return (
<IconButton onClick={handleClick} variant="ghost" aria-label="Change theme">
{theme === 'light' ? <SunIcon /> : <MoonIcon />}
</IconButton>
<Tooltip content="Change theme" side="right">
<IconButton
onClick={handleClick}
variant="ghost"
color="gray"
aria-label="Change theme"
>
{theme === 'light' ? <SunIcon /> : <MoonIcon />}
</IconButton>
</Tooltip>
)
}
Loading