Skip to content

Commit d158257

Browse files
committed
feat: integrate Monaco Editor and Tailwind CSS for enhanced UI
- Added @materia-ui/ngx-monaco-editor for Rust smart contract editing capabilities. - Implemented Tailwind CSS for styling, including a new postcss.config.js and tailwind.config.js. - Updated app configuration to include Monaco Editor services and routes for the editor component. - Created EditorComponent with compile and test functionalities for Rust code. - Enhanced global styles to incorporate Tailwind's utility classes. Signed-off-by: Pushkar Mishra <pushkarmishra029@gmail.com>
1 parent 9cb6a05 commit d158257

13 files changed

Lines changed: 504 additions & 278 deletions

apps/frontend/bun.lock

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

apps/frontend/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@angular/platform-server": "^20.1.0",
3333
"@angular/router": "^20.1.0",
3434
"@angular/ssr": "^20.1.4",
35+
"@materia-ui/ngx-monaco-editor": "^6.0.0",
3536
"express": "^5.1.0",
3637
"rxjs": "~7.8.0",
3738
"tslib": "^2.3.0"
@@ -52,6 +53,7 @@
5253
"@typescript-eslint/eslint-plugin": "latest",
5354
"@typescript-eslint/parser": "latest",
5455
"angular-eslint": "latest",
56+
"autoprefixer": "^10.4.21",
5557
"eslint": "^8.57.0",
5658
"eslint-config-prettier": "latest",
5759
"eslint-plugin-import": "latest",
@@ -63,6 +65,8 @@
6365
"karma-coverage": "~2.2.0",
6466
"karma-jasmine": "~5.1.0",
6567
"karma-jasmine-html-reporter": "~2.1.0",
68+
"postcss": "^8.5.6",
69+
"tailwindcss": "^3",
6670
"typescript": "~5.8.2"
6771
}
6872
}

apps/frontend/postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection } from '@angular/core';
1+
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection, NgZone } from '@angular/core';
22
import { provideRouter } from '@angular/router';
3+
import { MONACO_PATH, MonacoEditorLoaderService } from '@materia-ui/ngx-monaco-editor';
34

45
import { routes } from './app.routes';
56
import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
@@ -8,6 +9,18 @@ export const appConfig: ApplicationConfig = {
89
providers: [
910
provideBrowserGlobalErrorListeners(),
1011
provideZonelessChangeDetection(),
11-
provideRouter(routes), provideClientHydration(withEventReplay())
12+
provideRouter(routes),
13+
provideClientHydration(withEventReplay()),
14+
{
15+
provide: MONACO_PATH,
16+
useValue: 'https://unpkg.com/monaco-editor@0.31.1/min/vs'
17+
},
18+
{
19+
provide: MonacoEditorLoaderService,
20+
useFactory: (ngZone: NgZone) => {
21+
return new MonacoEditorLoaderService(ngZone, 'https://unpkg.com/monaco-editor@0.31.1/min/vs');
22+
},
23+
deps: [NgZone]
24+
}
1225
]
1326
};

apps/frontend/src/app/app.html

Lines changed: 1 addition & 273 deletions
Original file line numberDiff line numberDiff line change
@@ -1,273 +1 @@
1-
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
2-
<!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->
3-
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
4-
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * -->
5-
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
6-
<!-- * * * * * * * * * Delete the template below * * * * * * * * * -->
7-
<!-- * * * * * * * to get started with your project! * * * * * * * -->
8-
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
9-
10-
<style>
11-
:host {
12-
--bright-blue: oklch(51.01% 0.274 263.83);
13-
--electric-violet: oklch(53.18% 0.28 296.97);
14-
--french-violet: oklch(47.66% 0.246 305.88);
15-
--vivid-pink: oklch(69.02% 0.277 332.77);
16-
--hot-red: oklch(61.42% 0.238 15.34);
17-
--orange-red: oklch(63.32% 0.24 31.68);
18-
19-
--gray-900: oklch(19.37% 0.006 300.98);
20-
--gray-700: oklch(36.98% 0.014 302.71);
21-
--gray-400: oklch(70.9% 0.015 304.04);
22-
23-
--red-to-pink-to-purple-vertical-gradient: linear-gradient(
24-
180deg,
25-
var(--orange-red) 0%,
26-
var(--vivid-pink) 50%,
27-
var(--electric-violet) 100%
28-
);
29-
30-
--red-to-pink-to-purple-horizontal-gradient: linear-gradient(
31-
90deg,
32-
var(--orange-red) 0%,
33-
var(--vivid-pink) 50%,
34-
var(--electric-violet) 100%
35-
);
36-
37-
--pill-accent: var(--bright-blue);
38-
39-
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
40-
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
41-
"Segoe UI Symbol";
42-
box-sizing: border-box;
43-
-webkit-font-smoothing: antialiased;
44-
-moz-osx-font-smoothing: grayscale;
45-
}
46-
47-
h1 {
48-
font-size: 3.125rem;
49-
color: var(--gray-900);
50-
font-weight: 500;
51-
line-height: 100%;
52-
letter-spacing: -0.125rem;
53-
margin: 0;
54-
font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
55-
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
56-
"Segoe UI Symbol";
57-
}
58-
59-
p {
60-
margin: 0;
61-
color: var(--gray-700);
62-
}
63-
64-
main {
65-
width: 100%;
66-
min-height: 100%;
67-
display: flex;
68-
justify-content: center;
69-
align-items: center;
70-
padding: 1rem;
71-
box-sizing: inherit;
72-
position: relative;
73-
}
74-
75-
.angular-logo {
76-
max-width: 9.2rem;
77-
}
78-
79-
.content {
80-
display: flex;
81-
justify-content: space-around;
82-
width: 100%;
83-
max-width: 700px;
84-
margin-bottom: 3rem;
85-
}
86-
87-
.content h1 {
88-
margin-top: 1.75rem;
89-
}
90-
91-
.content p {
92-
margin-top: 1.5rem;
93-
}
94-
95-
.divider {
96-
width: 1px;
97-
background: var(--red-to-pink-to-purple-vertical-gradient);
98-
margin-inline: 0.5rem;
99-
}
100-
101-
.pill-group {
102-
display: flex;
103-
flex-direction: column;
104-
align-items: start;
105-
flex-wrap: wrap;
106-
gap: 1.25rem;
107-
}
108-
109-
.pill {
110-
display: flex;
111-
align-items: center;
112-
--pill-accent: var(--bright-blue);
113-
background: color-mix(in srgb, var(--pill-accent) 5%, transparent);
114-
color: var(--pill-accent);
115-
padding-inline: 0.75rem;
116-
padding-block: 0.375rem;
117-
border-radius: 2.75rem;
118-
border: 0;
119-
transition: background 0.3s ease;
120-
font-family: var(--inter-font);
121-
font-size: 0.875rem;
122-
font-style: normal;
123-
font-weight: 500;
124-
line-height: 1.4rem;
125-
letter-spacing: -0.00875rem;
126-
text-decoration: none;
127-
white-space: nowrap;
128-
}
129-
130-
.pill:hover {
131-
background: color-mix(in srgb, var(--pill-accent) 15%, transparent);
132-
}
133-
134-
.pill-group .pill:nth-child(6n + 1) {
135-
--pill-accent: var(--bright-blue);
136-
}
137-
.pill-group .pill:nth-child(6n + 2) {
138-
--pill-accent: var(--electric-violet);
139-
}
140-
.pill-group .pill:nth-child(6n + 3) {
141-
--pill-accent: var(--french-violet);
142-
}
143-
144-
.pill-group .pill:nth-child(6n + 4),
145-
.pill-group .pill:nth-child(6n + 5),
146-
.pill-group .pill:nth-child(6n + 6) {
147-
--pill-accent: var(--hot-red);
148-
}
149-
150-
.pill-group svg {
151-
margin-inline-start: 0.25rem;
152-
}
153-
154-
.social-links {
155-
display: flex;
156-
align-items: center;
157-
gap: 0.73rem;
158-
margin-top: 1.5rem;
159-
}
160-
161-
.social-links path {
162-
transition: fill 0.3s ease;
163-
fill: var(--gray-400);
164-
}
165-
166-
.social-links a:hover svg path {
167-
fill: var(--gray-900);
168-
}
169-
170-
@media screen and (max-width: 650px) {
171-
.content {
172-
flex-direction: column;
173-
width: max-content;
174-
}
175-
176-
.divider {
177-
height: 1px;
178-
width: 100%;
179-
background: var(--red-to-pink-to-purple-horizontal-gradient);
180-
margin-block: 1.5rem;
181-
}
182-
}
183-
</style>
184-
185-
<main class="main">
186-
<div class="content">
187-
<div class="left-side">
188-
<img src="Scaffold-Rust-Logo.jpg" alt="" width="30">
189-
<h1>Hello, awesome developer!</h1>
190-
<p>Congratulations! Your app is running. 🎉</p>
191-
<p>We are very excited that you are contributing to this great project. This is just the Angular template, so everything needs to be modified. [including this text]</p>
192-
</div>
193-
<div class="divider" role="separator" aria-label="Divider"></div>
194-
<div class="right-side">
195-
<div class="pill-group">
196-
@for (item of [
197-
{ title: 'Explore the Repo', link: 'https://github.com/ScaffoldRust/Online-Soroban-Compiler' },
198-
]; track item.title) {
199-
<a
200-
class="pill"
201-
[href]="item.link"
202-
target="_blank"
203-
rel="noopener"
204-
>
205-
<span>{{ item.title }}</span>
206-
<svg
207-
xmlns="http://www.w3.org/2000/svg"
208-
height="14"
209-
viewBox="0 -960 960 960"
210-
width="14"
211-
fill="currentColor"
212-
>
213-
<path
214-
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
215-
/>
216-
</svg>
217-
</a>
218-
}
219-
</div>
220-
<div class="social-links">
221-
<a
222-
href="https://github.com/ScaffoldRust"
223-
aria-label="Github"
224-
target="_blank"
225-
rel="noopener"
226-
>
227-
<svg
228-
width="25"
229-
height="24"
230-
viewBox="0 0 25 24"
231-
fill="none"
232-
xmlns="http://www.w3.org/2000/svg"
233-
alt="Github"
234-
>
235-
<path
236-
d="M12.3047 0C5.50634 0 0 5.50942 0 12.3047C0 17.7423 3.52529 22.3535 8.41332 23.9787C9.02856 24.0946 9.25414 23.7142 9.25414 23.3871C9.25414 23.0949 9.24389 22.3207 9.23876 21.2953C5.81601 22.0377 5.09414 19.6444 5.09414 19.6444C4.53427 18.2243 3.72524 17.8449 3.72524 17.8449C2.61064 17.082 3.81137 17.0973 3.81137 17.0973C5.04697 17.1835 5.69604 18.3647 5.69604 18.3647C6.79321 20.2463 8.57636 19.7029 9.27978 19.3881C9.39052 18.5924 9.70736 18.0499 10.0591 17.7423C7.32641 17.4347 4.45429 16.3765 4.45429 11.6618C4.45429 10.3185 4.9311 9.22133 5.72065 8.36C5.58222 8.04931 5.16694 6.79833 5.82831 5.10337C5.82831 5.10337 6.85883 4.77319 9.2121 6.36459C10.1965 6.09082 11.2424 5.95546 12.2883 5.94931C13.3342 5.95546 14.3801 6.09082 15.3644 6.36459C17.7023 4.77319 18.7328 5.10337 18.7328 5.10337C19.3942 6.79833 18.9789 8.04931 18.8559 8.36C19.6403 9.22133 20.1171 10.3185 20.1171 11.6618C20.1171 16.3888 17.2409 17.4296 14.5031 17.7321C14.9338 18.1012 15.3337 18.8559 15.3337 20.0084C15.3337 21.6552 15.3183 22.978 15.3183 23.3779C15.3183 23.7009 15.5336 24.0854 16.1642 23.9623C21.0871 22.3484 24.6094 17.7341 24.6094 12.3047C24.6094 5.50942 19.0999 0 12.3047 0Z"
237-
/>
238-
</svg>
239-
</a>
240-
<a
241-
href="https://x.com/ScaffoldRust"
242-
aria-label="Twitter"
243-
target="_blank"
244-
rel="noopener"
245-
>
246-
<svg
247-
width="24"
248-
height="24"
249-
viewBox="0 0 24 24"
250-
fill="none"
251-
xmlns="http://www.w3.org/2000/svg"
252-
alt="Twitter"
253-
>
254-
<path
255-
d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
256-
/>
257-
</svg>
258-
</a>
259-
</div>
260-
</div>
261-
</div>
262-
</main>
263-
264-
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
265-
<!-- * * * * * * * * * * * The content above * * * * * * * * * * * * -->
266-
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * * -->
267-
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
268-
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
269-
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * * -->
270-
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
271-
272-
273-
<router-outlet />
1+
<router-outlet />
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
import { Routes } from '@angular/router';
2+
import { EditorComponent } from './components/editor/editor.component';
23

3-
export const routes: Routes = [];
4+
export const routes: Routes = [
5+
{ path: '', component: EditorComponent },
6+
{ path: 'editor', component: EditorComponent }
7+
];

apps/frontend/src/app/app.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ describe('App', () => {
1616
expect(app).toBeTruthy();
1717
});
1818

19-
it('should render title', () => {
19+
it('should render router outlet', () => {
2020
const fixture = TestBed.createComponent(App);
2121
fixture.detectChanges();
2222
const compiled = fixture.nativeElement as HTMLElement;
23-
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, frontend');
23+
expect(compiled.querySelector('router-outlet')).toBeTruthy();
2424
});
2525
});

0 commit comments

Comments
 (0)