Skip to content

Commit bcb78eb

Browse files
committed
workspace as url param
1 parent 450b97c commit bcb78eb

10 files changed

Lines changed: 31 additions & 32 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ ThingsCode (or **ticode** for short) is the interactive development studio built
1010

1111
**1. Download the latest version:**
1212

13-
- [Linux (amd64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.0/ticode-linux-amd64-1.0.0.tar.gz)
14-
- [Linux (arm64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.0/ticode-linux-arm64-1.0.0.tar.gz)
15-
- [Darwin (amd64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.0/ticode-darwin-amd64-1.0.0.tar.gz)
16-
- [Darwin (arm64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.0/ticode-darwin-arm64-1.0.0.tar.gz)
17-
- [Windows (amd64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.0/ticode-windows-amd64-1.0.0.zip)
18-
- [Windows (arm64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.0/ticode-windows-arm64-1.0.0.zip)
13+
- [Linux (amd64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.1/ticode-linux-amd64-1.0.1.tar.gz)
14+
- [Linux (arm64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.1/ticode-linux-arm64-1.0.1.tar.gz)
15+
- [Darwin (amd64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.1/ticode-darwin-amd64-1.0.1.tar.gz)
16+
- [Darwin (arm64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.1/ticode-darwin-arm64-1.0.1.tar.gz)
17+
- [Windows (amd64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.1/ticode-windows-amd64-1.0.1.zip)
18+
- [Windows (arm64)](https://github.com/thingsdb/ThingsCode/releases/download/v1.0.1/ticode-windows-arm64-1.0.1.zip)
1919

2020
**2. Extract the contents of the archive using a tool like `tar`. Here's an example for Linux (amd64):**
2121

2222
```bash
23-
tar -xzvf ticode-linux-amd64-1.0.0.tar.gz
23+
tar -xzvf ticode-linux-amd64-1.0.1.tar.gz
2424
```
2525

2626
**3. Install:**
@@ -69,27 +69,27 @@ npm run build
6969

7070
mkdir -p bin/darwin-amd64
7171
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o bin/darwin-amd64/ticode
72-
tar -zcf bin/ticode-darwin-amd64-1.0.0.tar.gz -C ./bin/darwin-amd64/ ticode
72+
tar -zcf bin/ticode-darwin-amd64-1.0.1.tar.gz -C ./bin/darwin-amd64/ ticode
7373

7474
mkdir -p bin/darwin-arm64
7575
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -trimpath -o bin/darwin-arm64/ticode
76-
tar -zcf bin/ticode-darwin-arm64-1.0.0.tar.gz -C ./bin/darwin-arm64/ ticode
76+
tar -zcf bin/ticode-darwin-arm64-1.0.1.tar.gz -C ./bin/darwin-arm64/ ticode
7777

7878
mkdir -p bin/linux-amd64
7979
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o bin/linux-amd64/ticode
80-
tar -zcf bin/ticode-linux-amd64-1.0.0.tar.gz -C ./bin/linux-amd64/ ticode
80+
tar -zcf bin/ticode-linux-amd64-1.0.1.tar.gz -C ./bin/linux-amd64/ ticode
8181

8282
mkdir -p bin/linux-arm64
8383
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -trimpath -o bin/linux-arm64/ticode
84-
tar -zcf bin/ticode-linux-arm64-1.0.0.tar.gz -C ./bin/linux-arm64/ ticode
84+
tar -zcf bin/ticode-linux-arm64-1.0.1.tar.gz -C ./bin/linux-arm64/ ticode
8585

8686
mkdir -p bin/windows-amd64
8787
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o bin/windows-amd64/ticode.exe
88-
tar -zcf bin/ticode-windows-amd64-1.0.0.tar.gz -C ./bin/windows-amd64/ ticode.exe
88+
tar -zcf bin/ticode-windows-amd64-1.0.1.tar.gz -C ./bin/windows-amd64/ ticode.exe
8989

9090
mkdir -p bin/windows-arm64
9191
GOOS=windows GOARCH=arm64 CGO_ENABLED=0 go build -trimpath -o bin/windows-arm64/ticode.exe
92-
tar -zcf bin/ticode-windows-arm64-1.0.0.tar.gz -C ./bin/windows-arm64/ ticode.exe
92+
tar -zcf bin/ticode-windows-arm64-1.0.1.tar.gz -C ./bin/windows-arm64/ ticode.exe
9393
```
9494

9595
## Update

app/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package app
22

3-
const Version = "1.0.0" // And update package.json
3+
const Version = "1.0.1" // And update package.json

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ticode",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"private": true,
55
"type": "module",
66
"scripts": {

rsbuild.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { pluginReact } from '@rsbuild/plugin-react';
44

55
// Docs: https://rsbuild.rs/config/
66
export default defineConfig({
7+
html: {
8+
title: 'ThingsCode',
9+
},
710
plugins: [
811
pluginReact(),
912
pluginBabel({

src/components/AboutModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface AboutModalProps {
1010

1111
export default function AboutModal({ isOpen, onOpenChange }: AboutModalProps) {
1212
const { appearance } = useTheme();
13-
const appVersion = version || '1.0.0';
13+
const appVersion = version || '1.0.1';
1414

1515
return (
1616
<Dialog.Root open={isOpen} onOpenChange={onOpenChange}>

src/components/WorkspaceLauncher.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function WorkspaceLauncher() {
1313

1414
// Routing to workspace
1515
const handleWorkspaceClick = (id: string) => {
16-
window.history.pushState({}, '', `/workspace/${id}`);
16+
window.history.pushState({}, '', `/?workspace=${id}`);
1717
window.dispatchEvent(new PopStateEvent('popstate'));
1818
};
1919

src/hooks/useActiveWorkspaceId.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { useEffect, useState } from 'react';
22

3-
// Quick helper hook to grab the workspace ID out of the native browser URL window
43
export function useActiveWorkspaceId() {
5-
const [currentPath, setCurrentPath] = useState(window.location.pathname);
4+
const getWorkspaceId = () =>
5+
new URLSearchParams(window.location.search).get('workspace');
6+
7+
const [workspaceId, setWorkspaceId] = useState(getWorkspaceId);
68

79
useEffect(() => {
8-
const handleLocationChange = () => setCurrentPath(window.location.pathname);
10+
const handleLocationChange = () => setWorkspaceId(getWorkspaceId());
11+
912
window.addEventListener('popstate', handleLocationChange);
13+
1014
return () => window.removeEventListener('popstate', handleLocationChange);
1115
}, []);
1216

13-
if (currentPath.startsWith('/workspace/')) {
14-
return currentPath.replace('/workspace/', '');
15-
}
16-
return null;
17+
return workspaceId;
1718
}

src/providers/WorkspaceProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export function WorkspaceProvider({children, appearance}: WorkspaceProviderProps
103103
const quickConnect = async (tmpWs: Omit<Workspace, 'id'>) => {
104104
try {
105105
const id = await addWorkspaceHelper(tmpWs);
106-
window.history.pushState({}, '', `/workspace/${id}`);
106+
window.history.pushState({}, '', `?workspace=${id}`);
107107
window.dispatchEvent(new PopStateEvent('popstate'));
108108
} catch (err: unknown) {
109109
console.error("Failed to set-up quick connect workspace:", err);

ticode.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ func main() {
6969
app.ServeWs(w, r)
7070
})
7171

72-
// for example; /workspace/37f0e378 should also go to / and will be read by react app
73-
http.HandleFunc("/workspace/", func(w http.ResponseWriter, r *http.Request) {
74-
http.ServeFile(w, r, "./dist/index.html")
75-
})
76-
7772
server := &http.Server{
7873
Addr: fmt.Sprintf(":%d", *httpPortPtr),
7974
Handler: nil,

0 commit comments

Comments
 (0)