cleaning out legacy and making it work
This commit is contained in:
Vendored
+2
-1
@@ -9,5 +9,6 @@
|
||||
"workbench.colorTheme": "Default Light+",
|
||||
"javascript.format.semicolons": "insert",
|
||||
"window.zoomLevel": 1,
|
||||
"trunk.trunkGrayOutNonBlockingIssues": false
|
||||
|
||||
"eslint.workingDirectories": ["./packages/desktop"]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
**/legacy/**
|
||||
@@ -1,12 +1,10 @@
|
||||
import "./styles/index.css";
|
||||
import './styles/index.css';
|
||||
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
|
||||
import NirvanaApp from "./pages/nirvanaApp";
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
function render() {
|
||||
ReactDOM.render(<NirvanaApp />, document.getElementById("root"));
|
||||
ReactDOM.render(<div>test</div>, document.getElementById('root'));
|
||||
}
|
||||
|
||||
render();
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
export default function IconButton({ children }) {
|
||||
return (
|
||||
<button className="bg-gray-800 shadow-md h-7 w-7 text-white text-xs flex items-center justify-center">
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -3,19 +3,16 @@ import {
|
||||
$maxNumberActiveStreams,
|
||||
$numberActiveLines,
|
||||
$selectedLineId,
|
||||
} from "../../controller/recoil";
|
||||
import Channels, {
|
||||
DEFAULT_APP_PRESET,
|
||||
Dimensions,
|
||||
} from "../../electron/constants";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useRecoilState, useRecoilValue } from "recoil";
|
||||
} from '../../controller/recoil';
|
||||
import Channels, { DEFAULT_APP_PRESET, Dimensions } from '../../electron/constants';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
|
||||
import FullMottoLogo from "../../../../components/logo/fullMotto";
|
||||
import { LineDataProvider } from "../../controller/lineDataProvider";
|
||||
import { LogoType } from "@nirvana/components/logo/full";
|
||||
import NirvanaHeader from "../../components/header/index";
|
||||
import NirvanaTerminal from "../terminal";
|
||||
import FullMottoLogo from '../../../../components/logo/fullMotto';
|
||||
import { LineDataProvider } from '../../controller/lineDataProvider';
|
||||
import { LogoType } from '@nirvana/components/logo/full';
|
||||
import NirvanaHeader from '../../components/header/index';
|
||||
import NirvanaTerminal from '../terminal';
|
||||
|
||||
export default function NirvanaRouter() {
|
||||
const [selectedLineId, setSelectedLineId] = useRecoilState($selectedLineId);
|
||||
@@ -27,16 +24,16 @@ export default function NirvanaRouter() {
|
||||
useEffect(() => {
|
||||
// add dimensions if it's not overlay only mode
|
||||
let finalDimensions: Dimensions = { height: 0, width: 0 };
|
||||
let finalPosition: "center" | "topRight";
|
||||
let finalPosition: 'center' | 'topRight';
|
||||
|
||||
const setAlwaysOnTop = desktopMode === "overlayOnly";
|
||||
const setAlwaysOnTop = desktopMode === 'overlayOnly';
|
||||
|
||||
// go hunting for which dimensions to have
|
||||
if (desktopMode === "terminal" || desktopMode == "flowState") {
|
||||
if (desktopMode === 'terminal' || desktopMode == 'flowState') {
|
||||
finalDimensions = DEFAULT_APP_PRESET;
|
||||
}
|
||||
|
||||
if (desktopMode === "overlayOnly") {
|
||||
if (desktopMode === 'overlayOnly') {
|
||||
finalDimensions = {
|
||||
height: 68 + numberOfOverlayRows * 200,
|
||||
width: 360 + 360 * numberOfOverlayColumns,
|
||||
@@ -44,12 +41,12 @@ export default function NirvanaRouter() {
|
||||
}
|
||||
|
||||
console.log(
|
||||
"setting new dimensions",
|
||||
'setting new dimensions',
|
||||
desktopMode,
|
||||
numberOfOverlayColumns,
|
||||
numberOfOverlayRows,
|
||||
finalDimensions,
|
||||
setAlwaysOnTop
|
||||
setAlwaysOnTop,
|
||||
);
|
||||
|
||||
// send the final dimensions to main process
|
||||
@@ -70,7 +67,7 @@ export default function NirvanaRouter() {
|
||||
useEffect(() => {
|
||||
window.electronAPI.on(Channels.ON_WINDOW_BLUR, () => {
|
||||
console.log(
|
||||
"window blurring now, should be always on top and then ill tell main process to change dimensions"
|
||||
'window blurring now, should be always on top and then ill tell main process to change dimensions',
|
||||
);
|
||||
// TODO: testing mode... uncomment both instructions below
|
||||
// setDesktopMode("overlayOnly");
|
||||
@@ -83,14 +80,14 @@ export default function NirvanaRouter() {
|
||||
|
||||
return (
|
||||
<div className="flex flex-col flex-1">
|
||||
<NirvanaHeader onHeaderFocus={() => setDesktopMode("terminal")} />
|
||||
<NirvanaHeader onHeaderFocus={() => setDesktopMode('terminal')} />
|
||||
|
||||
{desktopMode === "flowState" && <FlowState />}
|
||||
{desktopMode === 'flowState' && <FlowState />}
|
||||
|
||||
{/* remount nirvana terminal */}
|
||||
{(desktopMode === "terminal" || desktopMode === "overlayOnly") && (
|
||||
{(desktopMode === 'terminal' || desktopMode === 'overlayOnly') && (
|
||||
<LineDataProvider>
|
||||
<NirvanaTerminal overlayOnly={desktopMode === "overlayOnly"} />
|
||||
<NirvanaTerminal overlayOnly={desktopMode === 'overlayOnly'} />
|
||||
</LineDataProvider>
|
||||
)}
|
||||
</div>
|
||||
@@ -109,7 +106,7 @@ function FlowState() {
|
||||
const [quote, setQuote] = useState<Quote>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetch("https://api.quotable.io/random")
|
||||
fetch('https://api.quotable.io/random')
|
||||
.then((res) => res.json())
|
||||
.then((data: Quote) => {
|
||||
console.warn(data);
|
||||
@@ -125,16 +122,11 @@ function FlowState() {
|
||||
return (
|
||||
<div className="flex flex-col flex-1 justify-center items-center relative">
|
||||
{/* <img src="https://source.unsplash.com/random/?nature" /> */}
|
||||
<FullMottoLogo
|
||||
type={LogoType.small}
|
||||
className={"absolute bottom-2 mx-auto"}
|
||||
/>
|
||||
<FullMottoLogo type={LogoType.small} className={'absolute bottom-2 mx-auto'} />
|
||||
|
||||
{quote && (
|
||||
<span className="flex flex-col justify-center items-center max-w-screen-sm">
|
||||
<span className="text-xl text-gray-800 font-semibold text-center">
|
||||
"{quote.content}"
|
||||
</span>
|
||||
<span className="text-xl text-gray-800 font-semibold text-center">"{quote.content}"</span>
|
||||
<span className="tex-md italic text-gray-400">{quote.author}</span>
|
||||
</span>
|
||||
)}
|
||||
Reference in New Issue
Block a user