Skip to content

Commit 5509c0a

Browse files
committed
feat : theme button, branding, error pages
1 parent 7ff52d5 commit 5509c0a

50 files changed

Lines changed: 770 additions & 126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ci/publish/main.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ rm -rf ./*
1818
mv .dist/* ./
1919
rm -rf .dist
2020

21+
cp index.html 404.html
22+
2123
git config user.name "Attachment Aditya"
2224
git config user.email "attachment.aditya@gmail.com"
2325

portable/core/resolvers/classes.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async function buildObjectFile(resolvedClassNames, templateLang="js") {
7777

7878
const fileContent = templates[templateLang].replace(
7979
'[[CLASS_NAMES]]',
80-
Array.from(new Set(resolvedClassNames)).map(
80+
Array.from(new Set(resolvedClassNames)).sort().map(
8181
name => ` '${name}': '${name}'`
8282
).join(',\n')
8383
);

portable/src/api/callers/base.ts

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
2+
const PROXY_URL = "https://proxy.attachment-aditya.workers.dev/";
3+
4+
interface BaseCallerConfig {
5+
baseApiUrl: string;
6+
defaultHeaders?: { [key: string]: string };
7+
referrer?: string;
8+
mode?: "cors" | "no-cors" | "same-origin";
9+
credentials?: "omit" | "same-origin" | "include";
10+
proxied?: boolean;
11+
lsCacheTTL?: number | null;
12+
lsCached?: boolean;
13+
}
14+
15+
export class BaseCaller {
16+
private baseApiUrl: string;
17+
private defaultHeaders: { [key: string]: string };
18+
private referrer?: string;
19+
private mode?: "cors" | "no-cors" | "same-origin";
20+
private credentials?: "omit" | "same-origin" | "include";
21+
private proxied: boolean;
22+
private lsCacheTTL: number | null;
23+
private lsCached: boolean;
24+
25+
constructor({
26+
baseApiUrl,
27+
defaultHeaders = {},
28+
referrer,
29+
mode = "cors",
30+
credentials = "same-origin",
31+
proxied=false,
32+
lsCacheTTL = null,
33+
lsCached = false,
34+
}: BaseCallerConfig) {
35+
this.baseApiUrl = baseApiUrl;
36+
this.defaultHeaders = defaultHeaders;
37+
this.referrer = referrer;
38+
this.mode = mode;
39+
this.credentials = credentials;
40+
this.proxied = proxied;
41+
this.lsCacheTTL = lsCacheTTL;
42+
this.lsCached = lsCached;
43+
}
44+
45+
async callApi(
46+
endpoint: string,
47+
method: Method = "GET",
48+
body: string | undefined = undefined,
49+
extraOptions: Partial<{
50+
headers: { [key: string]: string };
51+
referrer: string;
52+
mode: "cors" | "no-cors" | "same-origin";
53+
credentials: "omit" | "same-origin" | "include";
54+
}> = {}
55+
) {
56+
const keyStatic = `${this.baseApiUrl}:${endpoint}`
57+
const keyDynamic = `${method}:${body}`;
58+
const lsCacheKey = `apiCache::${keyStatic}:${keyDynamic}`;
59+
const lsCachedData = localStorage.getItem(lsCacheKey);
60+
61+
if (lsCachedData) {
62+
const { timestamp, data } = JSON.parse(lsCachedData);
63+
const alive = this.lsCacheTTL
64+
? (Date.now() - timestamp < this.lsCacheTTL)
65+
: true;
66+
67+
if (!alive) {
68+
localStorage.removeItem(lsCacheKey);
69+
} else {
70+
return data;
71+
}
72+
}
73+
74+
const finalUrl = this.baseApiUrl + endpoint;
75+
76+
const finalHeaders = {
77+
method,
78+
body,
79+
headers: this.defaultHeaders,
80+
referrer: this.referrer,
81+
mode: this.mode,
82+
credentials: this.credentials,
83+
...extraOptions,
84+
}
85+
86+
let response: Response;
87+
88+
if (!this.proxied) {
89+
response = await fetch(finalUrl, finalHeaders);
90+
} else {
91+
response = await fetch(PROXY_URL, {
92+
method: "POST",
93+
headers: {
94+
"Content-Type": "application/json",
95+
},
96+
body: JSON.stringify({
97+
url: finalUrl,
98+
options: finalHeaders,
99+
}),
100+
});
101+
}
102+
103+
if (!response.ok) {
104+
throw new Error(`API call failed with status ${response.status}`);
105+
}
106+
107+
const responseData = await response.json();
108+
109+
if (this.lsCached) {
110+
localStorage.setItem(lsCacheKey, JSON.stringify({
111+
timestamp: Date.now(),
112+
data: responseData,
113+
}));
114+
}
115+
116+
return responseData;
117+
}
118+
}
119+

portable/src/api/callers/github.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { BaseCaller } from "@api/callers/base";
2+
3+
export const githubCaller = new BaseCaller({
4+
baseApiUrl: "https://api.github.com",
5+
lsCached: true,
6+
lsCacheTTL: 1000 * 60 * 60 * 24,
7+
})
8+

portable/src/api/gh-api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+

portable/src/components/block/about.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ export function About() {
2020
</Text>
2121

2222
<LineBreak />
23-
2423
<Text>
2524
GraphScript is a visual scripting ecosystem that focuses on
2625
the logical and flow aspects of software development rather than
2726
the typical code-centric approach.
2827
</Text>
29-
30-
<LineBreak />
3128

29+
<LineBreak />
3230
<Text>
3331
It provides a visual interface where developers can create
3432
complex workflows and processes by creating and connecting nodes
@@ -37,7 +35,6 @@ export function About() {
3735
</Text>
3836

3937
<LineBreak />
40-
4138
<Text>
4239
This allows developers to focus on the logical structure of their
4340
applications without getting bogged down in the syntax and details

portable/src/components/block/footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function Footer({}: FooterProps) {
1515
<Heading size="max">
1616
GraphScript
1717
</Heading>
18-
18+
1919
<Heading size="small">
2020
© {year} GraphScript Labs
2121
</Heading>

portable/src/components/block/hero.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { useAsset } from "src/assets/assets";
2+
13
import { Container } from "@components/ui/structure/container";
24
import { Image } from "@components/ui/structure/image";
35
import { NodeBG } from "@components/ui/structure/node-bg";
46
import { Heading } from "@components/ui/text/heading";
5-
import { useAsset } from "src/assets/assets";
67
import { useClasses } from "@styles";
78

89
export function Hero() {

portable/src/components/block/timeline.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,42 @@ export function Timeline() {
1717
along with Python based Compiler available to any device that
1818
supports Python.
1919
</Text>
20-
20+
2121
<LineBreak /><LineBreak /><LineBreak />
22-
2322
<Text>
2423
The V1 is in progress with a schedule to release the V1 at
2524
June. It will include a more stable engine and a new interface
2625
that will be easier to use.
2726
</Text>
28-
29-
<LineBreak /><LineBreak /><LineBreak />
3027

28+
<LineBreak /><LineBreak /><LineBreak />
3129
<Text>
3230
V1 (Milestone 1) Internal Focus List:<LineBreak />
3331
- GSAM Engine V1<LineBreak />
3432
- GraphScript Editor V1<LineBreak />
3533
- Fresh and Better Landing Page
3634
</Text>
37-
38-
<LineBreak /><LineBreak /><LineBreak />
3935

36+
<LineBreak /><LineBreak /><LineBreak />
4037
<Text>
4138
Plans for future post V1:<LineBreak />
4239
- Milestone 2: Python Material (Support to use Python scripts
4340
with GSAM Language)<LineBreak />
41+
4442
- Milestone 3: GraphScript Auto Pilot (Vibe Code GraphScript
4543
with GS Auto Pilot)<LineBreak />
44+
4645
- Milestone 4: NodeJS Material (Support to use NodeJS scripts
4746
with GSAM Language)<LineBreak />
47+
4848
- Milestone 5: GS Remote (Execute GraphScript projects from
4949
a cloud machine)<LineBreak />
50+
5051
- Milestone 6: GS Zones (Easy Deploy GraphScript projects -
5152
suited for beginners)
5253
</Text>
53-
54-
<LineBreak /><LineBreak /><LineBreak />
5554

55+
<LineBreak /><LineBreak /><LineBreak />
5656
<Text>
5757
(Plans are subjected to possible additions and priority swaps
5858
based on new ideas, implementation methods, technology and hype)

portable/src/components/kit/infolet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import * as iconoir from "@attaditya/iconoir-preact/regular";
12
import { Container } from "@components/ui/structure/container";
23
import { Heading } from "@components/ui/text/heading";
34
import { Text } from "@components/ui/text/text";
45
import { useClasses } from "@styles";
5-
import * as iconoir from "@attaditya/iconoir-preact/regular";
66

77
interface InfoletProps {
88
icon: keyof typeof iconoir;

0 commit comments

Comments
 (0)