|
|
|
|
@ -3,10 +3,10 @@ import clsx from 'clsx'
|
|
|
|
|
|
|
|
|
|
import { TreeView } from '@/client/components/TreeView.jsx'
|
|
|
|
|
import { Editor } from '@/client/components/Editor.jsx'
|
|
|
|
|
import { useEffect } from 'preact/hooks'
|
|
|
|
|
import { useEffect, useRef } from 'preact/hooks'
|
|
|
|
|
import { Terminal } from './Terminal.jsx'
|
|
|
|
|
|
|
|
|
|
import { clamp, fetchJson, stripPrefix } from '@/client/utils.js'
|
|
|
|
|
import { clamp, fetchJson, stripPrefix, useClickOutside } from '@/client/utils.js'
|
|
|
|
|
|
|
|
|
|
export const Ide = ({}) => {
|
|
|
|
|
const ws = useSignal(null)
|
|
|
|
|
@ -42,10 +42,20 @@ export const Ide = ({}) => {
|
|
|
|
|
return tabs.value[activeTab.value].content
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const runCompoundButtonOpen = useSignal(false)
|
|
|
|
|
|
|
|
|
|
const runCompoundPopupRef = useRef(null)
|
|
|
|
|
|
|
|
|
|
useClickOutside(runCompoundPopupRef, () => {
|
|
|
|
|
runCompoundButtonOpen.value = false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div class="ide">
|
|
|
|
|
<div class="sidebar">
|
|
|
|
|
<div class="logo">PHC / Run</div>
|
|
|
|
|
<div class="logo">
|
|
|
|
|
<a href="/">PHC / Run</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="flex-row">
|
|
|
|
|
<button class="icon">
|
|
|
|
|
@ -82,6 +92,12 @@ export const Ide = ({}) => {
|
|
|
|
|
console.log('content', content)
|
|
|
|
|
|
|
|
|
|
batch(() => {
|
|
|
|
|
const existingIndex = tabs.value.findIndex(tab => tab.id === path)
|
|
|
|
|
if (existingIndex !== -1) {
|
|
|
|
|
activeTab.value = existingIndex
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tabs.value = [
|
|
|
|
|
...tabs.value,
|
|
|
|
|
{
|
|
|
|
|
@ -120,8 +136,8 @@ export const Ide = ({}) => {
|
|
|
|
|
alt="profile picture"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="username">{'aziis98'}</div>
|
|
|
|
|
<div class="email">{'aziis98'}@exmaple.com</div>
|
|
|
|
|
<div class="username">{'username'}</div>
|
|
|
|
|
<div class="email">{'username'}@exmaple.com</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="header">
|
|
|
|
|
@ -156,20 +172,28 @@ export const Ide = ({}) => {
|
|
|
|
|
>
|
|
|
|
|
Run
|
|
|
|
|
</span>
|
|
|
|
|
<span class="part">
|
|
|
|
|
<span
|
|
|
|
|
class="part"
|
|
|
|
|
onMouseDown={e => {
|
|
|
|
|
e.stopPropagation()
|
|
|
|
|
runCompoundButtonOpen.value = !runCompoundButtonOpen.value
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span class="material-symbols-outlined">keyboard_arrow_down</span>
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="popup anchor-mode-1">
|
|
|
|
|
<div class="menu">
|
|
|
|
|
<div class="item">Run</div>
|
|
|
|
|
<div class="item">Debug</div>
|
|
|
|
|
<div class="item">Test</div>
|
|
|
|
|
<div class="item">Profile</div>
|
|
|
|
|
<div class="item">Bench</div>
|
|
|
|
|
{runCompoundButtonOpen.value && (
|
|
|
|
|
<div class="popup anchor-mode-1" ref={runCompoundPopupRef}>
|
|
|
|
|
<div class="menu">
|
|
|
|
|
<div class="item">Run</div>
|
|
|
|
|
<div class="item">Debug</div>
|
|
|
|
|
<div class="item">Test</div>
|
|
|
|
|
<div class="item">Profile</div>
|
|
|
|
|
<div class="item">Bench</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@ -184,7 +208,7 @@ export const Ide = ({}) => {
|
|
|
|
|
<div class="buttons">
|
|
|
|
|
<button
|
|
|
|
|
class="flat icon"
|
|
|
|
|
onClick={e => {
|
|
|
|
|
onMouseDown={e => {
|
|
|
|
|
e.stopPropagation()
|
|
|
|
|
|
|
|
|
|
batch(() => {
|
|
|
|
|
|