Skip to content
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
22 changes: 19 additions & 3 deletions components/instructions-wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const mapAnswerSourceToWizard = (answer: DataAnswerSource): WizardAnswer => {
isDefault: answer.isDefault,
disabled: answer.disabled,
disabledLabel: answer.disabledLabel,
skippable: answer.skippable,
}
}

Expand All @@ -154,6 +155,7 @@ const buildStepFromQuestionSet = (
question: question.question,
allowMultiple: question.allowMultiple,
answers: question.answers.map(mapAnswerSourceToWizard),
skippable: question.skippable,
})),
})

Expand All @@ -165,6 +167,7 @@ const idesStep: WizardStep = {
id: "preferredIdes",
question: "Which IDEs should we prepare instructions for?",
allowMultiple: true,
skippable: false,
answers: (rawIdes as IdeConfig[]).map((ide) => ({
value: ide.id,
label: ide.label,
Expand All @@ -179,6 +182,7 @@ const idesStep: WizardStep = {
disabled: ide.enabled === false,
disabledLabel: ide.enabled === false ? "Soon" : undefined,
docs: ide.docs,
skippable: ide.skippable,
})),
},
],
Expand All @@ -191,13 +195,15 @@ const frameworksStep: WizardStep = {
{
id: FRAMEWORK_QUESTION_ID,
question: "Which framework are you working with?",
skippable: false,
answers: (rawFrameworks as FrameworkConfig[]).map((framework) => ({
value: framework.id,
label: framework.label,
icon: framework.icon,
disabled: framework.enabled === false,
disabledLabel: framework.enabled === false ? "Soon" : undefined,
docs: framework.docs,
skippable: framework.skippable,
})),
},
],
Expand Down Expand Up @@ -241,6 +247,7 @@ const filesStep: WizardStep = {
id: "outputFiles",
question: "Which instruction files should we generate?",
allowMultiple: true,
skippable: false,
answers: (filesData as FileOutputConfig[]).map((file) => {
const infoLines: string[] = []
if (file.filename) {
Expand All @@ -259,6 +266,7 @@ const filesStep: WizardStep = {
tags: file.format ? [file.format] : undefined,
disabled: file.enabled === false,
disabledLabel: file.enabled === false ? "Soon" : undefined,
skippable: file.skippable,
}
}),
},
Expand Down Expand Up @@ -374,6 +382,7 @@ export function InstructionsWizard({ onClose }: InstructionsWizardProps) {
id: question.id,
question: question.question,
allowMultiple: question.allowMultiple,
skippable: question.skippable,
answers: question.answers.map((answer) => {
const infoLines: string[] = []
if (answer.pros && answer.pros.length > 0) {
Expand All @@ -390,6 +399,7 @@ export function InstructionsWizard({ onClose }: InstructionsWizardProps) {
example: answer.example,
infoLines: infoLines.length > 0 ? infoLines : undefined,
docs: answer.docs,
skippable: answer.skippable,
}
}),
}))
Expand Down Expand Up @@ -473,6 +483,10 @@ export function InstructionsWizard({ onClose }: InstructionsWizardProps) {
}

const skipQuestion = () => {
if (currentQuestion.skippable === false) {
return
}

setResponses((prev) => ({
...prev,
[currentQuestion.id]: null,
Expand Down Expand Up @@ -722,9 +736,11 @@ export function InstructionsWizard({ onClose }: InstructionsWizardProps) {
<h1 className="text-3xl font-semibold text-foreground">
{currentQuestion.question}
</h1>
<Button variant="ghost" onClick={skipQuestion} className="shrink-0">
Skip
</Button>
{currentQuestion.skippable !== false ? (
<Button variant="ghost" onClick={skipQuestion} className="shrink-0">
Skip
</Button>
) : null}
</header>

<section className="rounded-3xl border border-border/80 bg-card/95 p-6 shadow-md">
Expand Down
14 changes: 9 additions & 5 deletions data/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"format": "markdown",
"enabled": true,
"icon": "markdown",
"docs": "https://docs.github.com/en/copilot"
"docs": "https://docs.github.com/en/copilot",
"skippable": false
},
{
"id": "agents-md",
Expand All @@ -15,15 +16,17 @@
"format": "markdown",
"enabled": true,
"icon": "markdown",
"docs": "https://docs.github.com/en/copilot"
"docs": "https://docs.github.com/en/copilot",
"skippable": false
},
{
"id": "cursor-rules",
"label": "Cursor Rules",
"filename": ".cursor/rules",
"format": "cursor-rules",
"enabled": false,
"docs": "https://docs.cursor.com/workflows/rules"
"docs": "https://docs.cursor.com/workflows/rules",
"skippable": false
},
{
"id": "json-rules",
Expand All @@ -32,6 +35,7 @@
"format": "json",
"enabled": false,
"icon": "json",
"docs": "https://json-schema.org/"
"docs": "https://json-schema.org/",
"skippable": false
}
]
]
9 changes: 6 additions & 3 deletions data/frameworks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
"label": "React",
"icon": "react",
"enabled": true,
"docs": "https://react.dev/learn"
"docs": "https://react.dev/learn",
"skippable": false
},
{
"id": "nextjs",
"label": "Next.js",
"icon": "nextdotjs",
"enabled": true,
"docs": "https://nextjs.org/docs"
"docs": "https://nextjs.org/docs",
"skippable": false
},
{
"id": "angular",
"label": "Angular",
"icon": "angular",
"enabled": false,
"docs": "https://angular.io/docs"
"docs": "https://angular.io/docs",
"skippable": false
}
]
6 changes: 5 additions & 1 deletion data/ides.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"icon": "visualstudiocode",
"enabled": true,
"docs": "https://code.visualstudio.com/docs",
"skippable": false,
"outputFiles": [
"instructions-md",
"agents-md"
Expand All @@ -16,6 +17,7 @@
"icon": "/icons/cursor.svg",
"enabled": false,
"docs": "https://docs.cursor.com/",
"skippable": false,
"outputFiles": [
"cursor-rules",
"json-rules"
Expand All @@ -27,6 +29,7 @@
"icon": "/icons/jetbrains.svg",
"enabled": false,
"docs": "https://www.jetbrains.com/help/",
"skippable": false,
"outputFiles": [
"instructions-md"
]
Expand All @@ -37,9 +40,10 @@
"icon": "windsurf",
"enabled": false,
"docs": "https://codeium.com/windsurf",
"skippable": false,
"outputFiles": [
"instructions-md",
"json-rules"
]
}
]
]
7 changes: 7 additions & 0 deletions types/wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type IdeConfig = {
enabled?: boolean
outputFiles?: string[]
docs?: string
skippable?: boolean
}

export type FrameworkConfig = {
Expand All @@ -13,6 +14,7 @@ export type FrameworkConfig = {
icon?: string
enabled?: boolean
docs?: string
skippable?: boolean
}

export type DataAnswerSource = {
Expand All @@ -27,13 +29,15 @@ export type DataAnswerSource = {
isDefault?: boolean
disabled?: boolean
disabledLabel?: string
skippable?: boolean
}

export type DataQuestionSource = {
id: string
question: string
allowMultiple?: boolean
answers: DataAnswerSource[]
skippable?: boolean
}

export type FileOutputConfig = {
Expand All @@ -44,6 +48,7 @@ export type FileOutputConfig = {
enabled?: boolean
icon?: string
docs?: string
skippable?: boolean
}

export type WizardAnswer = {
Expand All @@ -57,13 +62,15 @@ export type WizardAnswer = {
disabled?: boolean
disabledLabel?: string
docs?: string
skippable?: boolean
}

export type WizardQuestion = {
id: string
question: string
allowMultiple?: boolean
answers: WizardAnswer[]
skippable?: boolean
}

export type WizardStep = {
Expand Down
Loading