mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
## What kind of change does this PR introduce? Bug fix ## What is the current behavior? The "Join us on Discord" buttons are broken in two places: - **Studio support sidebar** (`HelpPanel`): on light mode the button background is not white, so the intended white button with purple icon and text is broken. - **www `/support` page** (shared `secondary` button variant): the text disappears on hover, and the Discord icon is never rendered (always invisible). Both issues occur on light and dark mode. ## What is the new behavior? - **Studio support sidebar**: force a white background on all colour schemes via `bg-white hover:bg-white/90`, matching the existing pattern in `DiscordCTACard`. The purple icon and text now render correctly on light mode. - **Shared `secondary` button variant** (`packages/ui`): - The icon container used `text-border-muted`, which blended into the `bg-foreground` button, so the icon was invisible. Changed to `text-background` to match the button's text colour. - The hover state used `text-border-stronger`, which had no contrast against the background, so text disappeared on hover. Changed to `text-background/80`. - Removed the ineffective `fill="var(--background-default)"` from `IconDiscord` on the `/support` page — the SVG path uses `currentColor`, so the fill prop had no effect. These `secondary` variant fixes apply globally, so other secondary buttons benefit too. | Before | After | | --- | --- | | <img width="868" height="642" alt="CleanShot 2026-07-07 at 15 39 42@2x" src="https://github.com/user-attachments/assets/6897b6ba-311e-43c7-bb5a-7b70017a54cc" /> | <img width="906" height="610" alt="CleanShot 2026-07-07 at 16 21 31@2x" src="https://github.com/user-attachments/assets/16104cf0-8ed1-4857-8467-532c1f7fdb5f" /> | | <img width="636" height="620" alt="CleanShot 2026-07-07 at 15 24 53@2x" src="https://github.com/user-attachments/assets/75f55f6c-eaa7-45ee-94fe-eac513126eff" /> | <img width="656" height="404" alt="CleanShot 2026-07-07 at 16 24 23@2x" src="https://github.com/user-attachments/assets/35649b23-fcdd-42fd-8140-e4aaf394667e" /> | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **Style** * Refreshed secondary button styling for a more consistent look, including updated hover and loading text/icon colors. * Improved the “Join us on Discord” button’s background and hover appearance. * Simplified the Discord card’s icon rendering to rely on the default icon styling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
129 lines
4.9 KiB
TypeScript
129 lines
4.9 KiB
TypeScript
import { IS_PLATFORM } from 'common'
|
|
import { ChevronLeft, X } from 'lucide-react'
|
|
import Image from 'next/image'
|
|
import { useRouter } from 'next/router'
|
|
import { useState } from 'react'
|
|
import SVG from 'react-inlinesvg'
|
|
import { Button } from 'ui'
|
|
|
|
import { ASSISTANT_SUGGESTIONS } from './HelpPanel.constants'
|
|
import { HelpSection } from './HelpSection'
|
|
import type { SupportFormUrlKeys } from '@/components/interfaces/Support/SupportForm.utils'
|
|
import {
|
|
SupportForm,
|
|
SupportFormStatusButton,
|
|
} from '@/components/interfaces/Support/SupportSidebarForm'
|
|
import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
|
|
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
|
|
import { useAiAssistantStateSnapshot } from '@/state/ai-assistant-state'
|
|
import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state'
|
|
|
|
export const HelpPanel = ({
|
|
onClose,
|
|
projectRef,
|
|
supportLinkQueryParams,
|
|
}: {
|
|
onClose: () => void
|
|
projectRef: string | undefined
|
|
supportLinkQueryParams: Partial<SupportFormUrlKeys> | undefined
|
|
}) => {
|
|
const snap = useAiAssistantStateSnapshot()
|
|
const { openSidebar, closeSidebar } = useSidebarManagerSnapshot()
|
|
const router = useRouter()
|
|
const [view, setView] = useState<'home' | 'support'>('home')
|
|
const isSupportView = view === 'support'
|
|
const openAssistant = () => {
|
|
onClose()
|
|
openSidebar(SIDEBAR_KEYS.AI_ASSISTANT)
|
|
snap.newChat(ASSISTANT_SUGGESTIONS)
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-full flex-col overflow-hidden">
|
|
<div className="flex h-(--header-height) items-center justify-between gap-2 border-b pl-4 pr-3">
|
|
<div className="flex min-w-0 items-center gap-1.5 text-xs">
|
|
{isSupportView && (
|
|
<ButtonTooltip
|
|
variant="text"
|
|
className="h-7 w-7"
|
|
onClick={() => setView('home')}
|
|
icon={<ChevronLeft strokeWidth={1.5} />}
|
|
tooltip={{ content: { side: 'bottom', text: 'Back' } }}
|
|
/>
|
|
)}
|
|
<span className="truncate">{isSupportView ? 'Contact support' : 'Help & Support'}</span>
|
|
</div>
|
|
<div className="flex items-center gap-2">
|
|
<SupportFormStatusButton />
|
|
<ButtonTooltip
|
|
variant="text"
|
|
className="w-7 h-7"
|
|
onClick={() => closeSidebar(SIDEBAR_KEYS.HELP_PANEL)}
|
|
icon={<X strokeWidth={1.5} />}
|
|
tooltip={{ content: { side: 'bottom', text: 'Close' } }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="flex-1 overflow-hidden">
|
|
{isSupportView ? (
|
|
<SupportForm initialParams={supportLinkQueryParams} />
|
|
) : (
|
|
<div className="flex h-full flex-col overflow-y-auto pb-5">
|
|
<HelpSection
|
|
excludeIds={['discord']}
|
|
isPlatform={IS_PLATFORM}
|
|
projectRef={projectRef}
|
|
supportLinkQueryParams={supportLinkQueryParams}
|
|
onAssistantClick={openAssistant}
|
|
onSupportClick={() => {
|
|
setView('support')
|
|
return false
|
|
}}
|
|
/>
|
|
<div className="flex flex-col gap-4 border-t pt-5">
|
|
<div className="px-5 flex flex-col gap-0.5">
|
|
<h5 className="text-foreground">Community support</h5>
|
|
<p className="text-xs text-foreground-lighter text-balance">
|
|
Our Discord community can help with code-related issues. Many questions are
|
|
answered in minutes.
|
|
</p>
|
|
</div>
|
|
<div className="px-5">
|
|
<div
|
|
className="relative space-y-2 overflow-hidden rounded-sm px-4 py-4 pb-12 shadow-md"
|
|
style={{ background: '#404EED' }}
|
|
>
|
|
<a
|
|
href="https://discord.supabase.com"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="group dark block cursor-pointer"
|
|
>
|
|
<Image
|
|
className="absolute left-0 top-0 opacity-50 transition-opacity group-hover:opacity-40"
|
|
src={`${router.basePath}/img/support/discord-bg-small.jpg`}
|
|
layout="fill"
|
|
objectFit="cover"
|
|
alt="Discord illustration"
|
|
/>
|
|
<Button
|
|
variant="secondary"
|
|
size="tiny"
|
|
className="bg-white hover:bg-white/90"
|
|
icon={
|
|
<SVG src={`${router.basePath}/img/discord-icon.svg`} className="h-4 w-4" />
|
|
}
|
|
>
|
|
<span style={{ color: '#404EED' }}>Join us on Discord</span>
|
|
</Button>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|