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

Max 10, Obv contribution, reword, hide header #82

Merged
merged 1 commit into from
May 22, 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
70 changes: 41 additions & 29 deletions app/compare/llms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ const LLMContainer = forwardRef<
HTMLDivElement,
{ llms: Array<LLMWithMetadata>; rect?: DOMRect }
>(({ llms, rect }, ref) => {
const { view, filter, theme, padding, spacing, ommitted, width, set } =
useURLState()
const {
view,
filter,
theme,
padding,
spacing,
ommitted,
width,
set,
hideHeader,
} = useURLState()

const [container, box] = useClientRect<HTMLDivElement>()

Expand Down Expand Up @@ -94,42 +103,45 @@ const LLMContainer = forwardRef<
>
<DragHandleBar />
</DragHandle>
<MotionFlex
style={{
paddingTop: springPadding,
paddingLeft: springPadding,
paddingRight: springPadding,
// not animating since it would cause issues with animating the gap
paddingBottom: spacing,
}}
>
<HeaderWidget
{hideHeader ? null : (
<MotionFlex
style={{
borderColor: fg2 + "65",
paddingTop: springPadding,
paddingLeft: springPadding,
paddingRight: springPadding,
// not animating since it would cause issues with animating the gap
paddingBottom: spacing,
}}
>
<Text size="lg" weight="bold" center multiline asChild>
<h1>
{llms.map((x, i) => (
<Fragment key={x.id}>
{x.name}
{i < llms.length - 1 ? (
<span className="text-foreground-dimmer font-medium">
{" vs "}
</span>
) : null}
</Fragment>
))}
</h1>
</Text>
</HeaderWidget>
</MotionFlex>
<HeaderWidget
style={{
borderColor: fg2 + "65",
}}
>
<Text size="lg" weight="bold" center multiline asChild>
<h1>
{llms.map((x, i) => (
<Fragment key={x.id}>
{x.name}
{i < llms.length - 1 ? (
<span className="text-foreground-dimmer font-medium">
{" vs "}
</span>
) : null}
</Fragment>
))}
</h1>
</Text>
</HeaderWidget>
</MotionFlex>
)}
<ItemsContainer
view={view}
style={{
paddingLeft: springPadding,
paddingRight: springPadding,
paddingBottom: springPadding,
paddingTop: hideHeader ? springPadding : undefined,
// gap can't be animated, using the direct state value
gap: spacing,
}}
Expand Down
6 changes: 5 additions & 1 deletion app/compare/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ const LLMSearch = forwardRef<

return (
<Search>
<Input size={size} {...getInputProps({ ref, ...props })} />
<Input
size={size}
{...getInputProps({ ref, ...props })}
disabled={llms.length >= 10}
/>
<DownshiftPopover hidden={!isOpen} inputSize={size} loading={isLoading}>
<ItemsContainer visible={items.length > 0} {...getMenuProps()}>
{items.map((item, index) => (
Expand Down
19 changes: 18 additions & 1 deletion app/compare/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import LLMIcon from "@/components/llm-icon"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {
DropdownMenu,
DropdownMenuCheckboxItem,
Expand Down Expand Up @@ -75,6 +76,7 @@ export default function Sidebar({
spacing,
ommitted,
setOmmittedField,
hideHeader,
} = useURLState()

const [hasActed, setHasActed] = useState(false)
Expand Down Expand Up @@ -311,6 +313,21 @@ export default function Sidebar({
</Text>
</Flex>
</Flex>
<Flex col gap={1}>
<Flex gap={2} align="center">
<Text weight="medium" color="dimmer">
Hide Header
</Text>
<Checkbox
checked={hideHeader}
onCheckedChange={checked => {
set({
hideHeader: checked ? "true" : "false",
})
}}
/>
</Flex>
</Flex>
{ommitted.length > 0 && (
<Flex col gap={1}>
<Text weight="medium" color="dimmer">
Expand Down Expand Up @@ -339,7 +356,7 @@ export default function Sidebar({
llms={llms}
setLLMs={setLLMs}
variant="elevated"
placeholder="Add another LLM"
placeholder={llms.length < 10 ? "Add another LLM" : "Max 10 LLMs"}
id="llm-sidebar-search"
/>
{llms.map(item => (
Expand Down
1 change: 1 addition & 0 deletions app/compare/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const optionsSchema = z.object({
padding: z.string().optional(),
spacing: z.string().optional(),
width: z.string().optional(),
hideHeader: z.enum(["true", "false"]).optional(),
})

export type OptionsType = z.infer<typeof optionsSchema>
2 changes: 2 additions & 0 deletions app/compare/use-url-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function useURLState() {
spacing = "16",
width = "1600",
omit,
hideHeader = "false",
}: OptionsType = Object.fromEntries(
searchParams.entries(),
) as unknown as OptionsType
Expand Down Expand Up @@ -91,6 +92,7 @@ export function useURLState() {
omit,
ommitted,
setOmmittedField,
hideHeader: hideHeader !== "false",
padding: Number(padding),
spacing: Number(spacing),
width: Number(width),
Expand Down
16 changes: 9 additions & 7 deletions app/contribute/join/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import useClientRect from "@/hooks/useElementSize"
import gr from "@/lib/gradients"
import { colors, tokens } from "@/tailwind.config"
import { useMotionValue, useSpring } from "framer-motion"
import { GithubIcon, Loader2Icon } from "lucide-react"
import { ExternalLinkIcon, Loader2Icon, PlusIcon } from "lucide-react"
import Link from "next/link"
import { useRouter } from "next/navigation"
import { useCallback, useEffect, useState } from "react"
Expand Down Expand Up @@ -95,9 +95,8 @@ export default function ContributorLoginPage() {
Apply as a Contributor
</Text>
<Text color="dimmer" multiline>
Your contribution request will be reviewed by an administrator
shortly. Once reviewed, you will be notified with further instructions
via email.
As a Contributor, you will be able to upload LLMs, vote on other
proposed LLMs, and help keep the information on LLM Arena up to date.
</Text>
<Button
onClick={async () => {
Expand All @@ -120,12 +119,15 @@ export default function ContributorLoginPage() {
{loading ? (
<Loader2Icon className="w-4 h-4 animate-spin" />
) : (
<GithubIcon className="w-4 h-4" />
<PlusIcon className="w-4 h-4" />
)}
<span>Join the waitlist</span>
<span>Apply to Contribute</span>
</Button>
<Button className="grow" asChild>
<Link href="/contribute">Read More</Link>
<a href="/contribute" target="_blank">
<span>Read More</span>
<ExternalLinkIcon className="w-4 h-4" />
</a>
</Button>
<Button variant="outline" className="grow" asChild>
<Link href="/">No thanks</Link>
Expand Down
4 changes: 2 additions & 2 deletions app/contribute/waitlist/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export default function WaitlistPage({ position }: { position: number }) {
</Text>

<Text color="dimmer" multiline>
You are #{position} on the waitlist. You&apos;ll receive an email when
you can start contributing.
You are #{position} on the waitlist. You will be notified by email
shortly once an administrator approves your contribution request.
</Text>

<Button variant="highlightElevated" className="grow" asChild>
Expand Down
19 changes: 17 additions & 2 deletions app/home/selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
PlusIcon,
XIcon,
} from "lucide-react"
import Link from "next/link"
import { useRouter } from "next/navigation"
import { useEffect, useRef, useState } from "react"
import { styled } from "react-tailwind-variants"
Expand Down Expand Up @@ -46,13 +47,19 @@ export default function Selector() {
{name}
</Text>
<Text color="dimmer">
Select two or more LLMs to see a side-by-side comparison
Select 2-10 LLMs to see a side-by-side comparison
</Text>
</Flex>
<LLMSearch
llms={llms}
setLLMs={setLLMs}
placeholder={llms.length === 0 ? "Add an LLM" : "Add another LLM"}
placeholder={
llms.length === 0
? "Add an LLM"
: llms.length < 10
? "Add another LLM"
: "Max 10 LLMs"
}
size="lg"
id="llm-search-input"
ref={llmSearchRef}
Expand Down Expand Up @@ -119,6 +126,14 @@ export default function Selector() {
See Comparison
<ArrowRightIcon className="w-6 h-6" />
</Button>
<Flex>
<Text color="dimmer">
Can&apos;t find an LLM?{" "}
<Link className="text-accent-dimmer" href="/contribute/join">
Add it
</Link>
</Text>
</Flex>
<Sheet
open={Boolean(selectedLLM)}
onOpenChange={open => setSelectedLLM(open ? selectedLLM : null)}
Expand Down
Loading