28 lines
906 B
TypeScript
28 lines
906 B
TypeScript
import type { ImageStudioApp } from "@app/app";
|
||
import { CanvasViewport } from "./CanvasViewport";
|
||
import { useAppState } from "./useAppState";
|
||
import "./index.css";
|
||
|
||
export type AppProps = {
|
||
app: ImageStudioApp;
|
||
};
|
||
|
||
export function App({ app }: AppProps) {
|
||
const state = useAppState(app.store);
|
||
const zoomPercent = Math.round(state.editor.viewport.zoom * 100);
|
||
|
||
return (
|
||
<main className="relative h-full bg-background text-foreground">
|
||
<header className="pointer-events-none absolute inset-x-0 top-0 z-10 flex h-8 items-center justify-between px-3 text-white">
|
||
<h1 className="text-sm font-medium">Image Studio</h1>
|
||
<div className="text-xs">
|
||
{state.document.name} · {zoomPercent}% · {state.editor.viewport.size.w}×{state.editor.viewport.size.h}
|
||
</div>
|
||
</header>
|
||
<CanvasViewport store={app.store} />
|
||
</main>
|
||
);
|
||
}
|
||
|
||
export default App;
|