chore: initialize @limitless/ui git repo + add AppShell
This brings the long-untracked @limitless/ui source tree under version
control. Until now /srv/k8s/templates/limitless-ui has been a plain
file: dependency consumed by gscChronos / gscCRM / gscAdmin, with
copies scattered across web/gsc{Portal,WWW,Aether,Register}/ and
apps/gsc{Meet,Share}/. None were git-tracked.
Treating /srv/k8s/templates/limitless-ui as the canonical going
forward; secondary copies should be replaced with this version
in their consumers' Dockerfiles when they next get touched.
Changes in this initial commit beyond the snapshot:
- Add src/layout/AppShell.tsx — runtime-loaded chrome (header,
sidebar, footer) backed by gsc-shell-api. Public surface:
AppShell, ShellProvider, useShell, ShellConfig types
Framework-agnostic (no Next.js dep). Apps pass appKey + apiUrl +
getToken; AppShell composes the existing PageShell / Navbar /
Sidebar / Footer primitives with API data.
- Re-export AppShell from src/index.ts.
- Fix build script: `tsc -p tsconfig.json --noEmit false`. The bare
`tsc` command was a no-op because tsconfig.json sets noEmit:true
for typecheck speed. Existing dist/ only existed because of an
earlier emit; clean rebuilds were silently broken.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
66
src/components/Modal.tsx
Normal file
66
src/components/Modal.tsx
Normal file
@@ -0,0 +1,66 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
export type ModalProps = {
|
||||
open: boolean;
|
||||
onClose?: () => void;
|
||||
title?: React.ReactNode;
|
||||
size?: 'sm' | 'lg' | 'xl';
|
||||
centered?: boolean;
|
||||
scrollable?: boolean;
|
||||
children: React.ReactNode;
|
||||
footer?: React.ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Bootstrap-style modal rendered in a portal with backdrop.
|
||||
*/
|
||||
export function Modal({ open, onClose, title, size, centered, scrollable, children, footer }: ModalProps) {
|
||||
const modalBody = (
|
||||
<div className={`modal fade ${open ? 'show' : ''}`} style={{ display: open ? 'block' : 'none' }} role="dialog" aria-modal="true">
|
||||
<div
|
||||
className={[
|
||||
'modal-dialog',
|
||||
size ? `modal-${size}` : '',
|
||||
centered ? 'modal-dialog-centered' : '',
|
||||
scrollable ? 'modal-dialog-scrollable' : ''
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
>
|
||||
<div className="modal-content">
|
||||
{title ? (
|
||||
<div className="modal-header">
|
||||
<h5 className="modal-title">{title}</h5>
|
||||
{onClose ? (
|
||||
<button type="button" className="btn-close" aria-label="Close" onClick={onClose}></button>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="modal-body">{children}</div>
|
||||
{footer ? <div className="modal-footer">{footer}</div> : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className={`modal-backdrop fade ${open ? 'show' : ''}`} />
|
||||
</div>
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof document === 'undefined') return;
|
||||
if (!open) return;
|
||||
const body = document.body;
|
||||
const previousOverflow = body.style.overflow;
|
||||
body.style.overflow = 'hidden';
|
||||
body.classList.add('modal-open');
|
||||
return () => {
|
||||
body.style.overflow = previousOverflow;
|
||||
body.classList.remove('modal-open');
|
||||
};
|
||||
}, [open]);
|
||||
|
||||
if (typeof document === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return createPortal(modalBody, document.body);
|
||||
}
|
||||
Reference in New Issue
Block a user