-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
381 changed files
with
5,048 additions
and
5,080 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import constate from 'constate'; | ||
import { I18N_PACKS } from './packs'; | ||
|
||
const useI18nValue = () => ({ | ||
pack: I18N_PACKS.en, | ||
}); | ||
|
||
export const [I18nProvider, useI18n] = constate(useI18nValue); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './I18nProvider'; | ||
export * from './packs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const EN_18N_VALUE = { | ||
header: { | ||
run: 'Run', | ||
stop: 'Stop', | ||
links: { | ||
github: 'Github project link', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { EN_18N_VALUE } from './en'; | ||
|
||
export const I18N_PACKS = { | ||
en: EN_18N_VALUE, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
import { useControlStrict } from '@under-control/forms'; | ||
import { trimLines } from '@ts-c-compiler/core'; | ||
import { useEditorState } from './EditorStateProvider'; | ||
|
||
import type { EditorStateValue } from './types'; | ||
|
||
import { EditorInput } from './Input/EditorInput'; | ||
import { EditorInput } from './Input'; | ||
import { EditorHeader } from './Header'; | ||
import { EditorSidebar } from './EditorSidebar'; | ||
|
||
export const EditorContainer = () => { | ||
const { bind, value } = useControlStrict<EditorStateValue>({ | ||
defaultValue: { | ||
lang: 'c', | ||
code: trimLines(` | ||
int main() { return 0; } | ||
`), | ||
}, | ||
}); | ||
|
||
console.info(value); | ||
const { | ||
control: { bind, value }, | ||
} = useEditorState(); | ||
|
||
return ( | ||
<div className="flex justify-center items-center"> | ||
<EditorInput lang={value.lang} {...bind.path('code')} /> | ||
<div className="flex h-screen flex-col"> | ||
<EditorHeader /> | ||
|
||
<div className="relative flex-1"> | ||
<div className="layer-absolute grid grid-cols-[1fr,40%]"> | ||
<EditorInput | ||
{...bind.path('code')} | ||
lang={value.lang} | ||
className="border-r border-gray-100" | ||
/> | ||
|
||
<EditorSidebar /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { I18nProvider } from '../../i18n'; | ||
import { EditorContainer } from './EditorContainer'; | ||
import { EditorStateProvider } from './EditorStateProvider'; | ||
|
||
export const EditorRoot = () => ( | ||
<I18nProvider> | ||
<EditorStateProvider> | ||
<EditorContainer /> | ||
</EditorStateProvider> | ||
</I18nProvider> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const EditorSidebar = () => { | ||
return <div className="p-4" />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './EditorSidebar'; |
19 changes: 19 additions & 0 deletions
19
apps/site/src/modules/Editor/EditorStateProvider/EditorStateProvider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useControlStrict } from '@under-control/forms'; | ||
import constate from 'constate'; | ||
|
||
import type { EditorStateValue } from './types'; | ||
|
||
const useEditorStateValue = () => { | ||
const control = useControlStrict<EditorStateValue>({ | ||
defaultValue: { | ||
lang: 'c', | ||
code: 'int main() { return 0; }', | ||
}, | ||
}); | ||
|
||
return { | ||
control, | ||
}; | ||
}; | ||
|
||
export const [EditorStateProvider, useEditorState] = constate(useEditorStateValue); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './EditorStateProvider'; | ||
export * from './types'; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Button } from 'flowbite-react'; | ||
import { BiLogoGithub, BiPause, BiPlay } from 'react-icons/bi'; | ||
|
||
import { useI18n } from 'i18n'; | ||
|
||
export const EditorHeader = () => { | ||
const t = useI18n().pack.header; | ||
|
||
return ( | ||
<header | ||
className="color-red flex w-full flex-row items-center justify-between border-b | ||
border-gray-200 bg-white px-4 py-2 align-middle" | ||
> | ||
<ol className="flex flex-row gap-2"> | ||
<li> | ||
<Button color="blue" size="sm"> | ||
{t.run} | ||
|
||
<BiPlay size={24} className="relative top-[1px] ml-1" /> | ||
</Button> | ||
</li> | ||
|
||
<li> | ||
<Button disabled color="gray" size="sm"> | ||
{t.stop} | ||
|
||
<BiPause size={24} className="relative top-[1px] ml-1" /> | ||
</Button> | ||
</li> | ||
</ol> | ||
|
||
<ol className="flex flex-row gap-2"> | ||
<li> | ||
<a | ||
href="https://github.com/Mati365/ts-c-compiler" | ||
target="_blank" | ||
rel="noreferrer noopener" | ||
title={t.links.github} | ||
className="text-gray-500" | ||
> | ||
<BiLogoGithub size={38} /> | ||
</a> | ||
</li> | ||
</ol> | ||
</header> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './EditorHeader'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.editor-codemirror :global { | ||
.CodeMirror { | ||
height: 100%; | ||
|
||
&-code { | ||
padding-top: 16px; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export * from './EditorContainer'; | ||
export * from './EditorRoot'; | ||
export * from './EditorStateProvider'; | ||
export * from './Header'; | ||
export * from './Input'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
import flowBitePlugin from 'flowbite/plugin'; | ||
|
||
export default { | ||
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
content: ['src/**/*.{ts,tsx}', '../../node_modules/flowbite-react/lib/esm/**/*.js'], | ||
plugins: [ | ||
({ addComponents }) => { | ||
flowBitePlugin, | ||
addComponents({ | ||
'.layer-absolute': { | ||
'@apply absolute left-0 top-0 w-full h-full': {}, | ||
}, | ||
}); | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.