Skip to content

Commit

Permalink
remove examples (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin authored Jan 28, 2025
1 parent 49ec37b commit f18652d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 129 deletions.
2 changes: 1 addition & 1 deletion src/cf_worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
return await api(url, request, env)
} else if (url.pathname === '/new' || url.pathname === '/new/') {
return await createNew(url, request, env)
} else if (url.pathname.startsWith('/store/') || url.pathname.startsWith('/example/')) {
} else if (url.pathname.startsWith('/store/') || url.pathname.startsWith('/blank')) {
url.pathname = '/'
return await env.ASSETS.fetch(url, request)
} else if (url.pathname.startsWith('/info')) {
Expand Down
4 changes: 1 addition & 3 deletions src/frontend/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Convert from 'ansi-to-html'
import Editor from './editor'
import Worker from './worker?worker'
import type { WorkerResponse, RunCode, CodeFile } from './types'
import { Examples } from './examples'

const decoder = new TextDecoder()
const ansiConverter = new Convert({ colors: { 1: '#CE9178', 4: '#569CD6', 5: '#BD00BD' } })
Expand Down Expand Up @@ -73,9 +72,8 @@ export default function () {
<a href="https://github.com/pydantic/pydantic.run" target="_blank">
github.com/pydantic/pydantic.run
</a>{' '}
for more info.
for more info. <a href="/blank">reset sandbox</a>.
</aside>
<Examples />
</header>
<section>
<Editor runCode={runCode} />
Expand Down
1 change: 0 additions & 1 deletion src/frontend/src/examples/hello_world.py

This file was deleted.

78 changes: 0 additions & 78 deletions src/frontend/src/examples/index.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions src/frontend/src/examples/logfire_example.py

This file was deleted.

27 changes: 0 additions & 27 deletions src/frontend/src/examples/pydantic_example.py

This file was deleted.

13 changes: 11 additions & 2 deletions src/frontend/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { CodeFile } from './types'
import { getExample } from './examples'

interface StoreHttpResponse {
readKey: string
Expand Down Expand Up @@ -78,8 +77,18 @@ export async function retrieve(): Promise<InitialState> {
}
}
}
const files = [
{
name: 'main.py',
content: `print('hello world')`,
activeIndex: 0,
},
]
if (pathname.startsWith('/blank')) {
files[0].content = ''
}
return {
files: getExample(pathname),
files,
allowSave: true,
allowFork: false,
}
Expand Down
15 changes: 2 additions & 13 deletions src/frontend/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,8 @@ a {
text-decoration: none;
}

.examples {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
margin: 3px 0;
a {
border-radius: 50px;
display: block;
background: $btn-green;
color: white !important;
padding: 4px 15px;
margin: 3px;
}
header {
margin-bottom: 5px;
}

.editor {
Expand Down

0 comments on commit f18652d

Please sign in to comment.