-
Notifications
You must be signed in to change notification settings - Fork 4
Add tools section / triplex integration / vscode extensions suggestion integration point #1
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
Changes from all commits
6e5ccf5
ae00b02
048542a
4b92d4f
1e1123c
1bd7e9c
1d654dd
241bdd4
1f1038f
89c7d1b
392e210
53698a0
42ca408
f92909f
b68010c
b267bde
138f255
dd018e8
9b1edbd
d02a25c
da29f9a
ed066b8
f6bca2d
267fd25
2feb296
962dab9
b483f7b
2745e6d
dd49de6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Build | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v2 | ||
| with: | ||
| version: latest | ||
| run_install: true | ||
|
|
||
| - name: Build packages | ||
| run: pnpm --filter "@react-three/*" build | ||
|
|
||
| - name: Build website | ||
| run: pnpm --filter "react-three-org-website" build | ||
|
|
||
| - name: Build gh-app | ||
| run: pnpm --filter "github-app" build |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Test | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v2 | ||
| with: | ||
| version: latest | ||
| run_install: true | ||
|
|
||
| - name: Run tests | ||
| run: pnpm test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,30 +4,25 @@ import { useQuery } from '@tanstack/react-query' | |
| import { PackageCard } from '@/components/package-card' | ||
| import { ProjectConfigurator } from '@/components/project-configurator' | ||
| import { NavBar } from '@/components/nav-bar' | ||
| import { packages } from '@/lib/packages' | ||
| import { packages, tools, PackageIDs, ToolIDs } from '@/lib/packages' | ||
| import { BackgroundAnimation } from '@/components/background-animation' | ||
| import { Button } from './components/ui/button.js' | ||
| import { CheckSquare, PackageIcon, X } from 'lucide-react' | ||
| import { CogIcon, PackageIcon } from 'lucide-react' | ||
| import { Toaster } from 'sonner' | ||
| import { SelectionSection } from './components/selection-section.js' | ||
|
|
||
| const searchParams = new URLSearchParams(location.search) | ||
|
|
||
| const sessionAccessTokenKey = 'access_token' | ||
| const sessionAccessToken = sessionStorage.getItem(sessionAccessTokenKey) | ||
|
|
||
| export function App() { | ||
| const [state, setState] = useState(() => searchParams.get('state')) | ||
| const [selectedPackages, setSelectedPackages] = useState<string[]>([]) | ||
| const [selectedPackages, setSelectedPackages] = useState<PackageIDs[]>([]) | ||
|
Contributor
Author
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. Currently the CLI defaults to everything selected, where as the app defaults to nothing selected. Should there be a sensible middle ground? |
||
| const [selectedTools, setSelectedTools] = useState<ToolIDs[]>(['triplex']) | ||
|
|
||
| if (state != null) { | ||
| return <GithubRepo state={state} /> | ||
| } | ||
|
|
||
| const togglePackage = (packageId: string) => { | ||
| setSelectedPackages((prev) => | ||
| prev.includes(packageId) ? prev.filter((id) => id !== packageId) : [...prev, packageId], | ||
| ) | ||
| } | ||
|
|
||
| return ( | ||
| <main className="relative min-h-screen flex flex-col pb-36"> | ||
| <BackgroundAnimation /> | ||
|
|
@@ -43,55 +38,66 @@ export function App() { | |
| {/* Visual separator using space instead of a border */} | ||
| <div className="mb-10 mt-8"></div> | ||
|
|
||
| <div className="flex flex-col mb-6"> | ||
|
Contributor
Author
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. This has been abstracted into a component |
||
| <div className="flex justify-between items-center"> | ||
| <p className="text-sm font-medium text-white/70 flex items-center"> | ||
| <PackageIcon className="h-3.5 w-3.5 mr-1.5 opacity-70" /> | ||
| Select packages to include in your project | ||
| </p> | ||
| <Button | ||
| variant="ghost" | ||
| size="sm" | ||
| className="text-xs hover:bg-white/5 flex items-center" | ||
| onClick={() => { | ||
| if (selectedPackages.length === packages.length) { | ||
| setSelectedPackages([]) | ||
| } else { | ||
| setSelectedPackages(packages.map((pkg) => pkg.id)) | ||
| } | ||
| }} | ||
| aria-label={selectedPackages.length === packages.length ? "Deselect all packages" : "Select all packages"} | ||
| > | ||
| {selectedPackages.length === packages.length ? ( | ||
| <X className="h-3.5 w-3.5 mr-1 opacity-70" /> | ||
| ) : ( | ||
| <CheckSquare className="h-3.5 w-3.5 mr-1 opacity-70" /> | ||
| )} | ||
| {selectedPackages.length === packages.length ? 'Deselect All' : 'Select All'} | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| <SelectionSection | ||
| value={selectedPackages} | ||
| icon={PackageIcon} | ||
| label="packages" | ||
| onChange={setSelectedPackages} | ||
| options={packages} | ||
| /> | ||
|
|
||
| <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6"> | ||
| {packages.map((pkg) => ( | ||
| <PackageCard | ||
| key={pkg.id} | ||
| package={pkg} | ||
| isSelected={selectedPackages.includes(pkg.id)} | ||
| onToggle={() => togglePackage(pkg.id)} | ||
| onToggle={() => { | ||
| setSelectedPackages((prev) => | ||
| prev.includes(pkg.id) ? prev.filter((id) => id !== pkg.id) : [...prev, pkg.id], | ||
| ) | ||
| }} | ||
| /> | ||
| ))} | ||
| </div> | ||
|
|
||
| {/* Visual separator using space instead of a border */} | ||
| <div className="mb-10 mt-8"></div> | ||
|
|
||
| <SelectionSection | ||
| label="tools" | ||
| value={selectedTools} | ||
| icon={CogIcon} | ||
|
Contributor
Author
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 used a cog icon, lmk if you'd prefer something else! |
||
| onChange={setSelectedTools} | ||
| options={tools} | ||
| /> | ||
|
|
||
| <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6"> | ||
| {tools.map((pkg) => ( | ||
| <PackageCard | ||
| key={pkg.id} | ||
| package={pkg} | ||
| isSelected={selectedTools.includes(pkg.id)} | ||
| onToggle={() => { | ||
| setSelectedTools((prev) => | ||
| prev.includes(pkg.id) ? prev.filter((id) => id !== pkg.id) : [...prev, pkg.id], | ||
| ) | ||
| }} | ||
| /> | ||
| ))} | ||
| </div> | ||
|
|
||
| <ProjectConfigurator | ||
| createGithubRepo={() => { | ||
| const integrations: any = {} | ||
| for (const integration of selectedPackages) { | ||
| const selections = [...selectedPackages, ...selectedTools] | ||
| for (const integration of selections) { | ||
| integrations[integration] = true | ||
| } | ||
|
|
||
| setState(btoa(JSON.stringify(integrations))) | ||
| }} | ||
| selectedPackages={selectedPackages} | ||
| selections={[...selectedPackages, ...selectedTools]} | ||
| /> | ||
| </div> | ||
| <Toaster | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { JSX } from 'react' | ||
| import { Button } from './ui/button' | ||
| import { Package } from '../lib/packages' | ||
| import { CheckSquare, X } from 'lucide-react' | ||
|
|
||
| interface SelectionSectionProps<TOption extends string> { | ||
| icon: (props: { className?: string }) => React.ReactNode | ||
| options: Package[] | ||
| value: TOption[] | ||
| onChange: (value: TOption[]) => void | ||
| label: string | ||
| } | ||
|
|
||
| export function SelectionSection<TOption extends string>({ | ||
| label, | ||
| value, | ||
| onChange, | ||
| options, | ||
| icon: Icon, | ||
| }: SelectionSectionProps<TOption>) { | ||
| return ( | ||
| <div className="flex flex-col mb-6"> | ||
| <div className="flex justify-between items-center"> | ||
| <p className="text-sm font-medium text-white/70 flex items-center"> | ||
| <Icon className="h-3.5 w-3.5 mr-1.5 opacity-70" /> | ||
| Select {label} to include in your project | ||
| </p> | ||
| <Button | ||
| variant="ghost" | ||
| size="sm" | ||
| className="text-xs hover:bg-white/5 flex items-center" | ||
| onClick={() => { | ||
| if (options.length === value.length) { | ||
| onChange([]) | ||
| } else { | ||
| onChange(options.map((pkg) => pkg.id as TOption)) | ||
| } | ||
| }} | ||
| aria-label={value.length === options.length ? `Deselect all ${label}` : `Select all ${label}`} | ||
| > | ||
| {value.length === options.length ? ( | ||
| <X className="h-3.5 w-3.5 mr-1 opacity-70" /> | ||
| ) : ( | ||
| <CheckSquare className="h-3.5 w-3.5 mr-1 opacity-70" /> | ||
| )} | ||
| {value.length === options.length ? 'Deselect All' : 'Select All'} | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if it's possible to test the GitHub creation flow locally, otherwise will have to wait and see...