Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
af0573b
Tutorial app from Markdown WIP
infomiho May 9, 2025
f30e545
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho May 16, 2025
f25bca5
Cleanup
infomiho May 16, 2025
a7d35a6
Parse diffs
infomiho May 16, 2025
04287c7
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho May 19, 2025
c29048e
Edit diff DX
infomiho May 19, 2025
373e563
Move patches outside of Markdown. Implement fixing broken diffs
infomiho May 19, 2025
8cf25a8
Cleanup
infomiho May 19, 2025
778602d
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Jul 16, 2025
72c0964
Cleanup
infomiho Jul 16, 2025
2a41ada
Named patches WIP
infomiho Jul 16, 2025
e7546b5
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Jul 17, 2025
10c1f1c
Update TutorialAction component
infomiho Jul 17, 2025
d00d7db
Update TutorialAction design
infomiho Jul 17, 2025
6a4a290
Stop using write action
infomiho Jul 17, 2025
0a2f90f
Cleanup
infomiho Jul 17, 2025
3ce2ca3
Cleanup
infomiho Jul 17, 2025
de1ad8a
Cleanup
infomiho Jul 17, 2025
1110026
Restructure
infomiho Jul 17, 2025
eee3f77
Refactor. Add edit step command.
infomiho Jul 17, 2025
3ea8530
Branded types, cleanup
infomiho Jul 17, 2025
c20ea08
Revert change to search-and-replace.ts
infomiho Jul 18, 2025
1348c89
Cleanup TutorialAction
infomiho Jul 18, 2025
69149ae
Cleanup
infomiho Jul 18, 2025
7ba6f4a
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Jul 18, 2025
d981153
Update styles
infomiho Jul 18, 2025
66b0fa8
Fixes patch fixing bug. Update patches.
infomiho Jul 31, 2025
8b3fe23
PR comments
infomiho Aug 4, 2025
5ad4372
Cleanup
infomiho Aug 5, 2025
f0d6ec3
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Aug 6, 2025
6522952
Formatting
infomiho Aug 6, 2025
80095ad
PR comments
infomiho Aug 6, 2025
f81a05d
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Aug 8, 2025
4e964f3
Refactor code
infomiho Aug 8, 2025
dc7fd21
Rename folder and update README
infomiho Aug 8, 2025
845e146
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Sep 12, 2025
4aa1173
PR comments
infomiho Sep 12, 2025
3af974a
Update naming
infomiho Sep 12, 2025
04f9ade
Move app init into a separate action
infomiho Sep 12, 2025
b3f9aae
PR comments
infomiho Sep 12, 2025
551679d
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Sep 15, 2025
1814a72
Update README
infomiho Sep 15, 2025
a2d043f
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Sep 29, 2025
ec4ec93
PR comments
infomiho Sep 29, 2025
fe58646
PR comments
infomiho Sep 29, 2025
6390e92
PR comments
infomiho Sep 29, 2025
939c066
Add unit tests
infomiho Sep 29, 2025
db7d68c
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Oct 6, 2025
aea3c6d
Update code block language
infomiho Oct 6, 2025
7c03e0c
Cleanup README
infomiho Oct 6, 2025
9ecdbd6
Wrap all steps with <TutorialAction> component
infomiho Oct 6, 2025
a28fa0c
Merge branch 'main' into miho-tutorial-app-from-docs
infomiho Oct 10, 2025
f78f56a
PR comments
infomiho Oct 10, 2025
19aec40
Update sort and filter fn names
infomiho Oct 10, 2025
85ff579
Extract example MDX files
infomiho Oct 10, 2025
f65fb22
Remove Git explanantion and update action name
infomiho Oct 10, 2025
7a1a3da
Update actions to action types
infomiho Oct 10, 2025
9dff3f1
Handle both md and mdx extensions
infomiho Oct 10, 2025
0ef5164
Update naming
infomiho Oct 10, 2025
6c3935d
Cleanup JSDoc
infomiho Oct 10, 2025
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
62 changes: 16 additions & 46 deletions web/docs/tutorial/03-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,15 @@ Start by cleaning up the starter project and removing unnecessary code and files

First, remove most of the code from the `MainPage` component:

<Tabs groupId="js-ts">
<TabItem value="js" label="JavaScript">
```jsx title="src/MainPage.jsx"
export const MainPage = () => {
return <div>Hello world!</div>
}
```
</TabItem>
<TutorialAction step="1" action="write" path="src/MainPage.tsx">

<TabItem value="ts" label="TypeScript">
<TutorialAction step="1" action="write" path="src/MainPage.tsx">

```tsx title="src/MainPage.tsx"
export const MainPage = () => {
return <div>Hello world!</div>
}
```

</TutorialAction>
</TabItem>
</Tabs>
```tsx title="src/MainPage.tsx" auto-js
export const MainPage = () => {
return <div>Hello world!</div>
}
```

</TutorialAction>

At this point, the main page should look like this:

Expand All @@ -131,6 +119,8 @@ Since `src/HelloPage.{jsx,tsx}` no longer exists, remove its `route` and `page`

Your Wasp file should now look like this:

<TutorialAction step="2" action="write" path="main.wasp">

```wasp title="main.wasp"
app TodoApp {
wasp: {
Expand All @@ -139,33 +129,13 @@ app TodoApp {
title: "TodoApp"
}

route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import { MainPage } from "@src/MainPage"
}
```
</TabItem>
route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import { MainPage } from "@src/MainPage"
}
```

<TabItem value="ts" label="TypeScript">
<TutorialAction step="2" action="write" path="main.wasp">

```wasp title="main.wasp"
app TodoApp {
wasp: {
version: "{latestWaspVersion}"
},
title: "TodoApp"
}

route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import { MainPage } from "@src/MainPage"
}
```

</TutorialAction>
</TabItem>
</Tabs>
</TutorialAction>

Excellent work!

Expand Down
92 changes: 24 additions & 68 deletions web/docs/tutorial/05-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,23 @@ We need to add a **query** declaration to `main.wasp` so that Wasp knows it exis
Next, create a new file called `src/queries.ts` and define the TypeScript function we've just imported in our `query` declaration:
</ShowForTs>

<TutorialAction step="6" action="write" path="src/queries.ts">

```ts title="src/queries.ts" auto-js
import type { Task } from 'wasp/entities'
import type { GetTasks } from 'wasp/server/operations'

<TabItem value="ts" label="TypeScript">
<TutorialAction step="6" action="write" path="src/queries.ts">
export const getTasks: GetTasks<void, Task[]> = async (args, context) => {
return context.entities.Task.findMany({
orderBy: { id: 'asc' },
})
}
```

```js title="src/queries.ts"
import { Task } from 'wasp/entities'
import { type GetTasks } from 'wasp/server/operations'
</TutorialAction>

export const getTasks: GetTasks<void, Task[]> = async (args, context) => {
return context.entities.Task.findMany({
orderBy: { id: 'asc' },
})
}
```

</TutorialAction>
<ShowForTs>
Wasp automatically generates the types `GetTasks` and `Task` based on the contents of `main.wasp`:

- `Task` is a type corresponding to the `Task` entity you defined in `schema.prisma`.
- `GetTasks` is a generic type Wasp automatically generated based on the `getTasks` Query you defined in `main.wasp`.
Expand Down Expand Up @@ -152,6 +150,8 @@ While we implement Queries on the server, Wasp generates client-side functions t

This makes it easy for us to use the `getTasks` Query we just created in our React component:

<TutorialAction step="7" action="write" path="src/MainPage.tsx">

```tsx title="src/MainPage.tsx" auto-js
import type { Task } from 'wasp/entities'
// highlight-next-line
Expand Down Expand Up @@ -185,62 +185,18 @@ const TaskView = ({ task }: { task: Task }) => {
const TasksList = ({ tasks }: { tasks: Task[] }) => {
if (!tasks?.length) return <div>No tasks</div>

return (
<div>
{tasks.map((task, idx) => (
<TaskView task={task} key={idx} />
))}
</div>
)
}
```
</TabItem>
return (
<div>
{tasks.map((task, idx) => (
<TaskView task={task} key={idx} />
))}
</div>
)
}
// highlight-end
```

<TabItem value="ts" label="TypeScript">
<TutorialAction step="7" action="write" path="src/MainPage.tsx">

```tsx {1-2,5-14,17-36} title="src/MainPage.tsx"
import { Task } from 'wasp/entities'
import { getTasks, useQuery } from 'wasp/client/operations'

export const MainPage = () => {
const { data: tasks, isLoading, error } = useQuery(getTasks)

return (
<div>
{tasks && <TasksList tasks={tasks} />}

{isLoading && 'Loading...'}
{error && 'Error: ' + error}
</div>
)
}

const TaskView = ({ task }: { task: Task }) => {
return (
<div>
<input type="checkbox" id={String(task.id)} checked={task.isDone} />
{task.description}
</div>
)
}

const TasksList = ({ tasks }: { tasks: Task[] }) => {
if (!tasks?.length) return <div>No tasks</div>

return (
<div>
{tasks.map((task, idx) => (
<TaskView task={task} key={idx} />
))}
</div>
)
}
```

</TutorialAction>
</TabItem>
</Tabs>
</TutorialAction>

Most of this code is regular React, the only exception being the <ShowForJs>two</ShowForJs><ShowForTs>three</ShowForTs> special `wasp` imports:

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.