Skip to content
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

add indication in the browser and cli that circuit is currently loading #51

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions cli/dev/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const registerDev = (program: Command) => {
.argument("[file]", "Path to the snippet file")
.option("-p, --port <number>", "Port to run server on", "3020")
.action(async (file: string, options: { port: string }) => {
console.log("Starting the development server, please wait...")

let port = parseInt(options.port)

const isPortAvailable = (port: number): Promise<boolean> => {
Expand Down Expand Up @@ -72,5 +74,6 @@ export const registerDev = (program: Command) => {

await server.start()
await server.addEntrypoint()
console.log("Development server started successfully.")
})
}
12 changes: 11 additions & 1 deletion lib/site/getIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ export const getIndex = async () => {
</head>
<body>
<script src="https://cdn.tailwindcss.com"></script>
<div id="root">loading...</div>
<style>
@tailwind base;
@tailwind components;
@tailwind utilities;
</style>
</head>
<body class="flex justify-center items-center h-screen bg-gray-100">
<div id="root" class="text-center">
<div class="spinner border-t-4 border-blue-500 rounded-full w-12 h-12 animate-spin mx-auto mb-4"></div>
<div class="text-lg text-gray-700">Loading, please wait...</div>
</div>
<script>
globalThis.process = { env: { NODE_ENV: "production" } }
</script>
Expand Down