Skip to content

Commit 40c6013

Browse files
Merge pull request #2 from skillrecordings/john/v2-release
fix(featured): updating featured scripts
2 parents 6ab7e95 + bb4a121 commit 40c6013

File tree

3 files changed

+37
-16
lines changed

3 files changed

+37
-16
lines changed

apps/scriptkit/featured.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
[
22
{
3-
"user": "johnlindquist",
4-
"command": "giphy-search"
3+
"user": "kentcdodds",
4+
"command": "new-post"
55
},
66
{
77
"user": "johnlindquist",
8-
"command": "image-resize"
8+
"command": "giphy-search"
99
},
1010
{
11-
"user": "johnlindquist",
12-
"command": "center-app"
11+
"user": "laura-ok",
12+
"command": "natural-language-shell-command"
1313
},
1414
{
15-
"user": "johnlindquist",
16-
"command": "reddit"
15+
"user": "mabry1985",
16+
"command": "prompt-anywhere-v2"
1717
},
1818
{
19-
"user": "johnlindquist",
20-
"command": "book-search"
19+
"user": "kentcdodds",
20+
"command": "extract-text-from-images"
2121
},
2222
{
2323
"user": "johnlindquist",
24-
"command": "app-launcher"
24+
"command": "image-resize"
2525
}
2626
]

apps/scriptkit/src/components/scripts/card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const ScriptCard: FunctionComponent<
2929
<div className="flex items-start px-6 pt-6">
3030
<div className="flex-grow">
3131
<h2 className="md:text-2xl text-xl font-bold leading-tight">
32-
{script.command}
32+
{script.title}
3333
</h2>
3434
{withAuthor && (
3535
<div className="flex space-x-2 font-xs text-sm opacity-70">

apps/scriptkit/src/pages/index.tsx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ const Home: FunctionComponent<React.PropsWithChildren<HomeProps>> = ({
186186
<div className="pt-10">
187187
<h3 className="text-3xl font-bold">Key Features</h3>
188188
<ul>
189+
<li className="pt-3">
190+
<span className="pr-3 text-yellow-300 text-lg">▪︎</span>
191+
Write your scripts in TypeScript with our SDK. Zero config.
192+
</li>
189193
<li className="pt-3">
190194
<span className="pr-3 text-yellow-300 text-lg">▪︎</span>
191195
Launch the prompt from anywhere as part of your flow
@@ -214,9 +218,9 @@ const Home: FunctionComponent<React.PropsWithChildren<HomeProps>> = ({
214218
</li>
215219
<li className="pt-3">
216220
<span className="pr-3 text-yellow-300 text-lg">▪︎</span>
217-
Load npm libraries:{''}
221+
Watches your scripts and prompts to install npm libraries:{''}
218222
<code className="whitespace-nowrap font-mono text-sm bg-yellow-500 bg-opacity-10 py-1 rounded-md text-yellow-300 px-2 ml-2">
219-
await npm("sharp")
223+
import express from "express"
220224
</code>
221225
</li>
222226
<li className="pt-3">
@@ -337,10 +341,27 @@ export async function getStaticProps(context: any) {
337341

338342
const scripts = await getAllScripts()
339343

340-
const featuredScripts = scripts.filter((s) => {
341-
return selectedScripts.find(
342-
(ss) => ss.user === s.user && ss.command === s.command,
344+
const featuredScriptsSet = new Set(
345+
selectedScripts.map((ss) => `${ss.user}/${ss.command}`),
346+
)
347+
const featuredScripts = []
348+
for (const script of scripts) {
349+
const scriptIdentifier = `${script.user}/${script.command}`
350+
if (featuredScriptsSet.has(scriptIdentifier)) {
351+
featuredScripts.push(script)
352+
featuredScriptsSet.delete(scriptIdentifier) // Ensure uniqueness
353+
}
354+
}
355+
356+
// Sort featuredScripts by order in selectedScripts
357+
featuredScripts.sort((a, b) => {
358+
const aIndex = selectedScripts.findIndex(
359+
(ss) => ss.user === a.user && ss.command === a.command,
360+
)
361+
const bIndex = selectedScripts.findIndex(
362+
(ss) => ss.user === b.user && ss.command === b.command,
343363
)
364+
return aIndex - bIndex
344365
})
345366

346367
const testimonials = await getTestimonials()

0 commit comments

Comments
 (0)