Skip to content

Commit 2146bff

Browse files
updates
1 parent bae330b commit 2146bff

File tree

6 files changed

+62
-6
lines changed

6 files changed

+62
-6
lines changed

lib/builder.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { useTranslations } from 'next-intl';
2929
import { useRouter } from 'next/router';
3030
import Script from 'next/script';
3131
import useMonacoVersion, { defaultMonacoVersion } from './monacoversion.js';
32+
import Select from './ui/select.js';
3233

3334
const Builder = () => {
3435
const translate = useTranslations();
@@ -38,11 +39,13 @@ const Builder = () => {
3839

3940
return (
4041
<>
41-
<div>
42-
<span>{translate.raw('builder-file')}</span>
42+
<div className='builder'>
43+
<div><span>{translate.raw('builder-file')}</span><input id='builder-filepath' placeholder='index' /></div>
44+
<span>{translate.raw('builder-filecontent')}</span>
4345
<div id="monaco" />
46+
<div><span>{translate.raw('builder-filetype')}</span><Select placeholder={translate.raw('builder-language')} items={[['JavaScript', '0']]} /></div>
4447
</div>
45-
<Script id="monaco-editor">
48+
<Script id="rewrite-fetch">
4649
{`
4750
var require = { paths: { 'vs': 'third-party/monaco-editor/package/min/vs' } };
4851
@@ -90,6 +93,12 @@ const Builder = () => {
9093
<Script id="builder">
9194
{`
9295
var h_div = document.getElementById('monaco');
96+
const defwidth = window.innerWidth;
97+
window.addEventListener('resize', () => {
98+
if (defwidth < window.innerWidth) {
99+
window.location.reload();
100+
}
101+
});
93102
var editor = monaco.editor.create(h_div, {
94103
value: [
95104
'function x() {',

lib/ui/select.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
3+
MIT License
4+
5+
Copyright (c) 2025 JustStudio <https://juststudio.is-a.dev/>
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.
24+
25+
*/
26+
27+
import { useEffect, useState } from 'react';
28+
29+
const Select = ({
30+
placeholder,
31+
items,
32+
variable
33+
}) => {
34+
const [hover, setHover] = useState(false);
35+
const [id, setId] = useState(0);
36+
37+
return (
38+
<>
39+
<button onMouseEnter={setHover(true)} onMouseLeave={setHover(false)} title={placeholder} type='button'><img src={items[id][1]} alt={items[id][0]} />{items[id][0]}</button>
40+
{hover? <div></div> : <></>}
41+
</>
42+
)
43+
}

locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"builder-file": "File",
33
"builder-filecontent": "Content",
4-
"builder-filetype": "Type"
4+
"builder-filetype": "Type",
5+
"builder-language": "Language"
56
}

locales/ru.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"builder-file": "Файл",
33
"builder-filecontent": "Содержание",
4-
"builder-filetype": "Тип"
4+
"builder-filetype": "Тип",
5+
"builder-language": "Язык"
56
}

pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const Home = () => {
3737
return (
3838
<>
3939
<h1 className='bg lz cw demo agt'>Just an Ultimate Site Tool</h1>
40-
<Builder className='builder' />
40+
<Builder />
4141
</>
4242
);
4343
};

pages/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,6 @@ h1 {
116116

117117
#monaco {
118118
height: 420px;
119+
left: 50%;
120+
translate: -50% 0%;
119121
}

0 commit comments

Comments
 (0)