Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

Mobile: fix every screen at phone widths

Pixel (kwant bot)c29f064e2d60
diff --git a/frontend/src/components/AuthGate.tsx b/frontend/src/components/AuthGate.tsx
index a1633826..8dd32ba0 100644
--- a/frontend/src/components/AuthGate.tsx
+++ b/frontend/src/components/AuthGate.tsx
@@ -178,12 +178,12 @@ export const PersonTokenDialog: React.FC<{ onClose: () => void; onSignedIn: () =
return () => window.removeEventListener('keydown', onKey);
}, [onClose]);
return (
- <div className="fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4 font-sans" onClick={onClose}>
+ <div className="kw-dialog kw-dialog-bottom fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4 font-sans" onClick={onClose}>
<div
role="dialog"
aria-modal="true"
aria-labelledby="kwnt-person-token-title"
- className="relative w-full max-w-md bg-zinc-900 border border-zinc-800 rounded-2xl p-6 shadow-2xl text-zinc-100"
+ className="kw-dialog-panel relative w-full max-w-md bg-zinc-900 border border-zinc-800 rounded-2xl p-6 shadow-2xl text-zinc-100"
onClick={(e) => e.stopPropagation()}
>
<button
diff --git a/frontend/src/components/ChannelInstructionsModal.tsx b/frontend/src/components/ChannelInstructionsModal.tsx
index 7023fd1a..dbc8c23f 100644
--- a/frontend/src/components/ChannelInstructionsModal.tsx
+++ b/frontend/src/components/ChannelInstructionsModal.tsx
@@ -47,13 +47,13 @@ export const ChannelInstructionsModal: React.FC<{
};
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-2 sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-2 sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
<form
role="dialog"
aria-modal="true"
aria-labelledby="chan-instr-title"
onSubmit={submit}
- className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-lg w-full max-h-[94vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-4"
+ className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-lg w-full max-h-[94vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-4"
>
<div className="flex items-center justify-between border-b border-zinc-800 pb-3">
<div className="flex items-center gap-2">
diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsx
index 59f163b7..8ad5d5be 100644
--- a/frontend/src/components/ChatView.tsx
+++ b/frontend/src/components/ChatView.tsx
@@ -341,6 +341,20 @@ const LayaRoutingCard: React.FC<{ routing: RoutingState; spaceName?: string }> =
);
};
+/** True below Tailwind's sm breakpoint, kept in sync with resizes. */
+const useNarrow = () => {
+ const query = '(max-width: 639px)';
+ const [narrow, setNarrow] = useState(() => typeof window !== 'undefined' && !!window.matchMedia?.(query).matches);
+ useEffect(() => {
+ const mq = window.matchMedia?.(query);
+ if (!mq) return;
+ const on = () => setNarrow(mq.matches);
+ mq.addEventListener('change', on);
+ return () => mq.removeEventListener('change', on);
+ }, []);
+ return narrow;
+};
+
export const ChatView: React.FC<ChatViewProps> = ({
title,
subtitle,
@@ -401,6 +415,7 @@ export const ChatView: React.FC<ChatViewProps> = ({
renderHumanStep,
contextKey,
}) => {
+ const narrow = useNarrow();
const [internalIsVmPaneOpen, setInternalIsVmPaneOpen] = useState(false);
const vmOpen = isVmPaneOpen !== undefined ? isVmPaneOpen : internalIsVmPaneOpen;
const toggleVm = onToggleVmPane || (() => setInternalIsVmPaneOpen((prev) => !prev));
@@ -1362,7 +1377,8 @@ export const ChatView: React.FC<ChatViewProps> = ({
checkMention(inputVal, (e.target as HTMLTextAreaElement).selectionStart);
}
}}
- placeholder={spaceName ? `Message ${title} in ${spaceName}` : `Message ${title}`}
+ // Phones drop the space name so the 16px placeholder fits on one line
+ placeholder={spaceName && !narrow ? `Message ${title} in ${spaceName}` : `Message ${title}`}
title="Enter to send, Shift+Enter for a new line, @ to mention"
className="flex-1 min-w-0 bg-transparent px-3 py-1.5 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none resize-none max-h-40 leading-relaxed font-sans"
diff --git a/frontend/src/components/ClaudeSignIn.tsx b/frontend/src/components/ClaudeSignIn.tsx
index b3a1b42d..96c4e3b8 100644
--- a/frontend/src/components/ClaudeSignIn.tsx
+++ b/frontend/src/components/ClaudeSignIn.tsx
@@ -352,14 +352,14 @@ export const ClaudeSignOut: React.FC<{ onSignedOut: (engines: EngineInfo[]) => v
<LogOut size={10} aria-hidden="true" /> Sign out
</button>
{open && (
- <div className="fixed inset-0 z-[60] bg-black/60 flex items-center justify-center p-4" onMouseDown={(e) => e.target === e.currentTarget && close()}>
+ <div className="kw-dialog kw-dialog-bottom fixed inset-0 z-[60] bg-black/60 flex items-center justify-center p-4" onMouseDown={(e) => e.target === e.currentTarget && close()}>
<div
role="alertdialog"
aria-modal="true"
aria-labelledby="claude-signout-title"
aria-describedby="claude-signout-desc"
onKeyDown={onKeyDown}
- className="w-full max-w-sm bg-zinc-900 border border-zinc-700 rounded-xl p-4 shadow-2xl space-y-3 text-zinc-100"
+ className="kw-dialog-panel w-full max-w-sm bg-zinc-900 border border-zinc-700 rounded-xl p-4 shadow-2xl space-y-3 text-zinc-100"
>
<h4 id="claude-signout-title" className="text-sm font-semibold">
Sign out of Claude?
diff --git a/frontend/src/components/DeleteBotDialog.tsx b/frontend/src/components/DeleteBotDialog.tsx
index afee9942..5c6f84b5 100644
--- a/frontend/src/components/DeleteBotDialog.tsx
+++ b/frontend/src/components/DeleteBotDialog.tsx
@@ -86,14 +86,14 @@ export const DeleteBotDialog: React.FC<DeleteBotDialogProps> = ({ kwant, busy, o
'inline-flex items-center justify-center gap-1.5 min-h-[40px] sm:min-h-[34px] px-3.5 rounded-lg text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2';
return (
- <div className="fixed inset-0 z-[60] bg-black/70 backdrop-blur-sm flex items-center justify-center p-4" onKeyDown={onKeyDown}>
+ <div className="kw-dialog kw-dialog-bottom fixed inset-0 z-[60] bg-black/70 backdrop-blur-sm flex items-center justify-center p-4" onKeyDown={onKeyDown}>
<div
ref={boxRef}
role="alertdialog"
aria-modal="true"
aria-labelledby="delete-bot-title"
aria-describedby="delete-bot-desc"
- className="bg-zinc-900 border border-rose-500/30 rounded-2xl max-w-md w-full max-h-[92vh] overflow-y-auto p-4 sm:p-5 text-zinc-100 shadow-2xl space-y-4"
+ className="kw-dialog-panel bg-zinc-900 border border-rose-500/30 rounded-2xl max-w-md w-full max-h-[92vh] overflow-y-auto p-4 sm:p-5 text-zinc-100 shadow-2xl space-y-4"
>
<div className="flex items-start gap-2.5">
<div className="w-8 h-8 shrink-0 rounded-lg bg-rose-500/10 border border-rose-500/25 flex items-center justify-center text-rose-300">
diff --git a/frontend/src/components/DeviceSignIn.tsx b/frontend/src/components/DeviceSignIn.tsx
index 0464319b..b7e122a3 100644
--- a/frontend/src/components/DeviceSignIn.tsx
+++ b/frontend/src/components/DeviceSignIn.tsx
@@ -199,13 +199,13 @@ export const DeviceRequestCard: React.FC<{
const [matches, setMatches] = useState(false);
useEffect(() => setMatches(false), [request.user_code]);
return (
- <div className="fixed inset-0 z-[90] flex items-center justify-center bg-black/70 p-4 font-sans">
+ <div className="kw-dialog kw-dialog-bottom fixed inset-0 z-[90] flex items-center justify-center bg-black/70 p-4 font-sans">
<div
role="alertdialog"
aria-modal="true"
aria-labelledby="kwnt-device-request-title"
aria-describedby="kwnt-device-request-warning"
- className="relative w-full max-w-sm bg-zinc-900 border border-zinc-800 rounded-2xl p-5 shadow-2xl text-zinc-100 space-y-4"
+ className="kw-dialog-panel relative w-full max-w-sm bg-zinc-900 border border-zinc-800 rounded-2xl p-5 shadow-2xl text-zinc-100 space-y-4"
>
<button
type="button"
diff --git a/frontend/src/components/FolderBrowserModal.tsx b/frontend/src/components/FolderBrowserModal.tsx
index 91bff985..9e5e9851 100644
--- a/frontend/src/components/FolderBrowserModal.tsx
+++ b/frontend/src/components/FolderBrowserModal.tsx
@@ -87,8 +87,8 @@ export const FolderBrowserModal: React.FC<FolderBrowserModalProps> = ({
const pathParts = currentPath.split('/').filter(Boolean);
return (
- <div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4 select-none animate-in fade-in duration-150">
- <div className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-xl w-full p-5 text-zinc-100 shadow-2xl flex flex-col max-h-[85vh]">
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4 select-none animate-in fade-in duration-150">
+ <div className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-xl w-full p-5 text-zinc-100 shadow-2xl flex flex-col max-h-[85vh]">
{/* Header */}
<div className="flex items-center justify-between border-b border-zinc-800 pb-3 mb-3">
<div className="flex items-center gap-2">
diff --git a/frontend/src/components/ImportDialog.tsx b/frontend/src/components/ImportDialog.tsx
index 4551c469..7677d488 100644
--- a/frontend/src/components/ImportDialog.tsx
+++ b/frontend/src/components/ImportDialog.tsx
@@ -533,14 +533,14 @@ export const ImportDialog: React.FC<Props> = ({ spaceName, onClose, onChanged })
}
return (
- <div className="fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex sm:items-center justify-center sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex sm:items-center justify-center sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
<div
ref={dialogRef}
onKeyDown={onTrapKey}
role="dialog"
aria-modal="true"
aria-labelledby="import-title"
- className="bg-zinc-900 sm:border border-zinc-800 sm:rounded-2xl w-full sm:max-w-xl h-full sm:h-auto sm:max-h-[90vh] flex flex-col text-zinc-100 shadow-2xl"
+ className="kw-dialog-panel bg-zinc-900 sm:border border-zinc-800 sm:rounded-2xl w-full sm:max-w-xl h-full sm:h-auto sm:max-h-[90vh] flex flex-col text-zinc-100 shadow-2xl"
>
<div className="flex items-center gap-2 border-b border-zinc-800 px-4 py-3">
{step.kind !== 'choose' && step.kind !== 'done' && (
diff --git a/frontend/src/components/ManageTeamModal.tsx b/frontend/src/components/ManageTeamModal.tsx
index 6ba13b8e..ab5dbc6c 100644
--- a/frontend/src/components/ManageTeamModal.tsx
+++ b/frontend/src/components/ManageTeamModal.tsx
@@ -205,8 +205,8 @@ export const ManageTeamModal: React.FC<ManageTeamModalProps> = ({
};
return (
- <div className="fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4 select-none animate-in fade-in duration-150">
- <div role="dialog" aria-modal="true" aria-labelledby="manage-team-title" className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-lg w-full max-h-[94vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5">
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4 select-none animate-in fade-in duration-150">
+ <div role="dialog" aria-modal="true" aria-labelledby="manage-team-title" className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-lg w-full max-h-[94vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5">
{/* Header */}
<div className="flex items-center justify-between border-b border-zinc-800 pb-3">
<div className="flex items-center gap-2.5">
diff --git a/frontend/src/components/McpServersModal.tsx b/frontend/src/components/McpServersModal.tsx
index 802a491e..1974a412 100644
--- a/frontend/src/components/McpServersModal.tsx
+++ b/frontend/src/components/McpServersModal.tsx
@@ -1122,12 +1122,12 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClos
);
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-2 sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && close()}>
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-2 sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && close()}>
<div
role="dialog"
aria-modal="true"
aria-labelledby="mcp-title"
- className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-2xl w-full max-h-[92vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5"
+ className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-2xl w-full max-h-[92vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5"
>
<div className="flex items-center justify-between gap-3 border-b border-zinc-800 pb-4">
<div className="flex items-center gap-2.5 min-w-0">
diff --git a/frontend/src/components/NewAgentModal.tsx b/frontend/src/components/NewAgentModal.tsx
index 3a726626..2b2665ae 100644
--- a/frontend/src/components/NewAgentModal.tsx
+++ b/frontend/src/components/NewAgentModal.tsx
@@ -211,12 +211,12 @@ export const NewAgentModal: React.FC<NewAgentModalProps> = ({
};
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4 select-none">
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4 select-none">
<div
role="dialog"
aria-modal="true"
aria-labelledby="agent-modal-title"
- className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-lg w-full max-h-[92vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5"
+ className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-lg w-full max-h-[92vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5"
>
<div className="flex items-center justify-between border-b border-zinc-800 pb-3">
<div className="flex items-center gap-2">
diff --git a/frontend/src/components/NewChannelModal.tsx b/frontend/src/components/NewChannelModal.tsx
index 727588bf..2ee27205 100644
--- a/frontend/src/components/NewChannelModal.tsx
+++ b/frontend/src/components/NewChannelModal.tsx
@@ -72,12 +72,12 @@ export const NewChannelModal: React.FC<NewChannelModalProps> = ({ isOpen, onClos
};
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4" onMouseDown={(e) => e.target === e.currentTarget && !submitting && onClose()}>
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4" onMouseDown={(e) => e.target === e.currentTarget && !submitting && onClose()}>
<div
role="dialog"
aria-modal="true"
aria-labelledby={titleId}
- className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-md w-full max-h-[calc(100dvh-2rem)] overflow-y-auto p-5 sm:p-6 text-zinc-100 shadow-2xl space-y-5"
+ className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-md w-full max-h-[calc(100dvh-2rem)] overflow-y-auto p-5 sm:p-6 text-zinc-100 shadow-2xl space-y-5"
>
<div className="flex items-center justify-between border-b border-zinc-800 pb-3">
<div className="flex items-center gap-2">
@@ -159,7 +159,7 @@ export const NewChannelModal: React.FC<NewChannelModalProps> = ({ isOpen, onClos
</label>
</div>
- <fieldset aria-describedby={hintId}>
+ <fieldset aria-describedby={hintId} className="min-w-0">
<div className="flex items-center justify-between mb-1.5">
<legend className="text-xs font-medium text-zinc-400">Bots in this channel</legend>
<span className="text-[11px] font-mono text-zinc-500">{members.length} picked</span>
@@ -181,7 +181,7 @@ export const NewChannelModal: React.FC<NewChannelModalProps> = ({ isOpen, onClos
className="rounded border-zinc-700 bg-zinc-900 text-sky-500 focus:ring-0 focus:ring-offset-0"
/>
<ModernAvatar role={k.avatar_sprite} name={k.name} size={24} />
- <span className="truncate">
+ <span className="truncate min-w-0">
<span className="font-semibold text-zinc-200">{k.name}</span>
<span className="text-[10px] text-zinc-400 ml-1.5">{k.title}</span>
</span>
diff --git a/frontend/src/components/NewTeamModal.tsx b/frontend/src/components/NewTeamModal.tsx
index a1494959..688048f7 100644
--- a/frontend/src/components/NewTeamModal.tsx
+++ b/frontend/src/components/NewTeamModal.tsx
@@ -183,8 +183,8 @@ export const NewTeamModal: React.FC<NewTeamModalProps> = ({
};
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4 select-none">
- <div className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-md w-full p-6 text-zinc-100 shadow-2xl space-y-5">
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4 select-none">
+ <div className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-md w-full p-6 text-zinc-100 shadow-2xl space-y-5">
{/* Header */}
<div className="flex items-center justify-between border-b border-zinc-800 pb-3">
<div className="flex items-center gap-2">
@@ -301,13 +301,13 @@ export const NewTeamModal: React.FC<NewTeamModalProps> = ({
{workspaceType === 'local' && (
<div className="space-y-2">
- <div className="flex gap-2 items-center">
+ <div className="flex flex-wrap sm:flex-nowrap gap-2 items-center">
<input
type="text"
value={workspacePath}
onChange={(e) => setWorkspacePath(e.target.value)}
placeholder="e.g. ~/projects/my-app or /path/to/folder"
- className="flex-1 bg-zinc-950 border border-zinc-800 rounded-lg px-3 py-2 text-xs text-zinc-100 placeholder-zinc-600 focus:border-sky-500 focus:outline-none transition-colors font-mono"
+ className="flex-1 min-w-0 basis-full sm:basis-auto bg-zinc-950 border border-zinc-800 rounded-lg px-3 py-2 text-xs text-zinc-100 placeholder-zinc-600 focus:border-sky-500 focus:outline-none transition-colors font-mono"
/>
<button
type="button"
@@ -351,7 +351,7 @@ export const NewTeamModal: React.FC<NewTeamModalProps> = ({
playSfx('click');
setWorkspacePath('~');
}}
- className="px-2 py-0.5 rounded bg-zinc-950 border border-zinc-800 text-zinc-400 hover:text-zinc-200 hover:border-zinc-700 font-mono transition-colors"
+ className="min-w-[44px] sm:min-w-0 px-2 py-0.5 rounded bg-zinc-950 border border-zinc-800 text-zinc-400 hover:text-zinc-200 hover:border-zinc-700 font-mono transition-colors"
>
~
</button>
diff --git a/frontend/src/components/PasswordStorePanel.tsx b/frontend/src/components/PasswordStorePanel.tsx
index 90d34ba6..922fe180 100644
--- a/frontend/src/components/PasswordStorePanel.tsx
+++ b/frontend/src/components/PasswordStorePanel.tsx
@@ -320,8 +320,8 @@ export const UnlockDialog: React.FC<{ status: StoreStatus | null; onClose: () =>
return () => window.removeEventListener('keydown', onKey);
}, [onClose]);
return (
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-3" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
- <div role="dialog" aria-modal="true" aria-labelledby={`${id}-h`} className="relative w-full max-w-sm rounded-2xl border border-zinc-800 bg-zinc-900 p-4 shadow-2xl" data-unlock-dialog>
+ <div className="kw-dialog kw-dialog-bottom fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-3" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
+ <div role="dialog" aria-modal="true" aria-labelledby={`${id}-h`} className="kw-dialog-panel relative w-full max-w-sm rounded-2xl border border-zinc-800 bg-zinc-900 p-4 shadow-2xl" data-unlock-dialog>
<h2 id={`${id}-h`} className="sr-only">
Unlock Bitwarden
</h2>
diff --git a/frontend/src/components/RoutinesModal.tsx b/frontend/src/components/RoutinesModal.tsx
index 068864fc..962246b0 100644
--- a/frontend/src/components/RoutinesModal.tsx
+++ b/frontend/src/components/RoutinesModal.tsx
@@ -22,12 +22,12 @@ export const RoutinesModal: React.FC<{ isOpen: boolean; onClose: () => void; kwa
if (!isOpen) return null;
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-2 sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-2 sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
<div
role="dialog"
aria-modal="true"
aria-labelledby="routines-title"
- className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-2xl w-full max-h-[94vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5"
+ className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-2xl w-full max-h-[94vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5"
>
<div className="flex items-center justify-between border-b border-zinc-800 pb-4">
<div className="flex items-center gap-2.5">
diff --git a/frontend/src/components/SearchModal.tsx b/frontend/src/components/SearchModal.tsx
index 38b02434..3ab7761a 100644
--- a/frontend/src/components/SearchModal.tsx
+++ b/frontend/src/components/SearchModal.tsx
@@ -105,13 +105,13 @@ export const SearchModal: React.FC<{
let index = -1;
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-start justify-center p-2 sm:p-4 sm:pt-[12vh]" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-start justify-center p-2 sm:p-4 sm:pt-[12vh]" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
<div
role="dialog"
aria-modal="true"
aria-label="Search chats"
onKeyDown={onKeyDown}
- className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-xl w-full max-h-[86vh] flex flex-col text-zinc-100 shadow-2xl overflow-hidden"
+ className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-xl w-full max-h-[86vh] flex flex-col text-zinc-100 shadow-2xl overflow-hidden"
>
<div className="flex items-center gap-2 px-3 sm:px-4 border-b border-zinc-800">
{loading ? (
diff --git a/frontend/src/components/SettingsModal.tsx b/frontend/src/components/SettingsModal.tsx
index 19d9d059..da52721a 100644
--- a/frontend/src/components/SettingsModal.tsx
+++ b/frontend/src/components/SettingsModal.tsx
@@ -223,8 +223,8 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({ isOpen, onClose, t
};
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4 select-none">
- <div role="dialog" aria-modal="true" aria-labelledby="settings-title" className="bg-zinc-900 border border-zinc-800 rounded-2xl max-w-lg sm:max-w-2xl w-full max-h-[92vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-6">
+ <div className="kw-dialog fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4 select-none">
+ <div role="dialog" aria-modal="true" aria-labelledby="settings-title" className="kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-2xl max-w-lg sm:max-w-2xl w-full max-h-[92vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-6">
{/* Header */}
<div className="flex items-center justify-between border-b border-zinc-800 pb-4">
<div className="flex items-center gap-2.5">
diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx
index 174a4025..6b37baa3 100644
--- a/frontend/src/components/Sidebar.tsx
+++ b/frontend/src/components/Sidebar.tsx
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from 'react';
-import { Hash, Plus, CheckCircle2, AlertTriangle, Loader2, Users, ChevronDown, Settings2, X, Crown, UserPlus, Pencil, Inbox, Search, CalendarClock, ShieldOff, ListChecks, Split, Hand, Plug } from 'lucide-react';
+import { Hash, Plus, CheckCircle2, AlertTriangle, Loader2, Users, ChevronDown, Settings2, X, Crown, UserPlus, Pencil, Inbox, Search, CalendarClock, ShieldOff, ListChecks, Split, Hand, Plug, MoreHorizontal, UserMinus, MessageSquare } from 'lucide-react';
import { ModernAvatar } from './ModernAvatar';
import { playSfx } from '../audio/chiptune';
import { badgeText } from '../away';
@@ -183,6 +183,8 @@ export const Sidebar: React.FC<SidebarProps> = ({
const [collapsedTeams, setCollapsedTeams] = useState<Set<string>>(new Set());
const [addingTo, setAddingTo] = useState<string | null>(null);
const [switcherOpen, setSwitcherOpen] = useState(false);
+ /** Phones: the member whose actions sheet is open, and whether "Remove" is waiting for a confirm. */
+ const [memberMenu, setMemberMenu] = useState<{ team: Team; kwant: Kwant; confirmRemove?: boolean } | null>(null);
const closeSwitcher = useCallback(() => setSwitcherOpen(false), []);
const showChats = section !== 'bots';
const showBots = section !== 'chats';
@@ -219,6 +221,22 @@ export const Sidebar: React.FC<SidebarProps> = ({
};
const offLine = spaceOffLine(space.approvals, kwants);
+ // Phones: section titles stay pinned while their list scrolls, so they are never cut off
+ const sectionHead = `px-2 py-1 flex items-center justify-between text-[11px] font-semibold text-zinc-500 uppercase tracking-wider${
+ phone ? ' kw-sticky-head sticky top-0 z-10' : ''
+ }`;
+ // Phones: "New …" is a plain + icon (44px to tap) instead of a boxed button
+ const phoneAdd = (label: string, onClick: () => void) => (
+ <button
+ type="button"
+ onClick={onClick}
+ aria-label={label}
+ title={label}
+ className="-mr-1 rounded-full text-sky-400 hover:text-sky-300 hover:bg-sky-500/10 active:bg-sky-500/15 transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-500"
+ >
+ <Plus size={18} aria-hidden="true" />
+ </button>
+ );
return (
<aside
@@ -324,9 +342,9 @@ export const Sidebar: React.FC<SidebarProps> = ({
{/* Channels Section */}
{showChats && (
<div>
- <div className="px-2 py-1 flex items-center justify-between text-[11px] font-semibold text-zinc-500 uppercase tracking-wider">
+ <div className={sectionHead}>
<span>Channels</span>
- {onCreateChannel && kwants.length > 0 && (
+ {onCreateChannel && kwants.length > 0 && (phone ? phoneAdd(`New channel in ${space.name}`, onCreateChannel) :
<button
type="button"
onClick={onCreateChannel}
@@ -371,7 +389,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
{/* Teams Section */}
{showChats && (
<div>
- <div className="px-2 py-1 flex items-center justify-between text-[11px] font-semibold text-zinc-500 uppercase tracking-wider">
+ <div className={sectionHead}>
<button
type="button"
onClick={() => setTeamsOpen(!teamsOpen)}
@@ -383,6 +401,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
/>
<span>Teams ({teams.length})</span>
</button>
+ {phone ? phoneAdd(`New team in ${space.name}`, onCreateTeam) : (
<button
type="button"
onClick={onCreateTeam}
@@ -392,6 +411,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
<Plus size={11} />
<span>New team</span>
</button>
+ )}
</div>
{teamsOpen && (
@@ -472,7 +492,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
tabIndex={0}
onClick={() => onSelectKwant(k)}
onKeyDown={(e) => e.key === 'Enter' && onSelectKwant(k)}
- className={`group/member flex items-center gap-2 px-1.5 py-1 rounded-md cursor-pointer text-[11px] transition-colors ${
+ className={`group/member flex items-center gap-2 px-1.5 ${phone ? 'py-0' : 'py-1'} rounded-md cursor-pointer text-[11px] transition-colors ${
memberActive ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-400 hover:bg-zinc-800/50 hover:text-zinc-200'
}`}
title={busyKwants[k.id] ? `Chat with ${k.name} · ${busyKwants[k.id]}` : `Chat with ${k.name}`}
@@ -490,6 +510,32 @@ export const Sidebar: React.FC<SidebarProps> = ({
{busyKwants[k.id] && (
<span className="w-1.5 h-1.5 shrink-0 rounded-full bg-sky-400 animate-pulse motion-reduce:animate-none" aria-hidden="true" />
)}
+ {phone ? (
+ <>
+ {isLead && (
+ <span className="shrink-0 flex items-center gap-0.5 text-[9px] uppercase tracking-wide text-amber-300/90" title="Team lead">
+ <Crown size={10} aria-hidden="true" />
+ lead
+ </span>
+ )}
+ {(onEditKwant || (onUpdateTeamMembers && !isLead)) && (
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ playSfx('click');
+ setMemberMenu({ team: t, kwant: k });
+ }}
+ aria-haspopup="dialog"
+ aria-label={`More for ${k.name}`}
+ className="-mr-1 shrink-0 rounded-lg text-zinc-500 hover:text-zinc-200 hover:bg-zinc-800 active:bg-zinc-800 transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400"
+ >
+ <MoreHorizontal size={16} />
+ </button>
+ )}
+ </>
+ ) : (
+ <>
{onEditKwant && (
<button
type="button"
@@ -524,6 +570,8 @@ export const Sidebar: React.FC<SidebarProps> = ({
</button>
)
)}
+ </>
+ )}
</div>
);
})}
@@ -607,8 +655,9 @@ export const Sidebar: React.FC<SidebarProps> = ({
{/* Every bot in this space */}
{showBots && (
<div>
- <div className="px-2 py-1 flex items-center justify-between text-[11px] font-semibold text-zinc-500 uppercase tracking-wider">
+ <div className={sectionHead}>
<h2>Kwant bots ({kwants.length})</h2>
+ {phone ? phoneAdd(`New bot in ${space.name}`, () => onSummonKwant()) : (
<button
type="button"
onClick={() => onSummonKwant()}
@@ -618,6 +667,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
<Plus size={11} />
<span>New bot</span>
</button>
+ )}
</div>
<div className="mt-1 space-y-1">
{kwants.length === 0 && (
@@ -660,7 +710,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
</span>
)}
{approvalsOff(k) && <ApprovalsOffBadge compact title={`${k.name} runs commands, file writes and tools without asking.`} />}
- {onEditKwant && (
+ {onEditKwant && !phone && (
<button
type="button"
onClick={(e) => {
@@ -690,6 +740,21 @@ export const Sidebar: React.FC<SidebarProps> = ({
<p className="text-[11px] text-zinc-400 truncate mt-0.5">{k.title}</p>
)}
</div>
+ {/* Phones: the edit button sits at the row's end so it doesn't stretch the name line */}
+ {onEditKwant && phone && (
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ onEditKwant(k);
+ }}
+ className="shrink-0 -my-1 rounded-lg text-zinc-400 hover:text-sky-300 hover:bg-sky-500/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400"
+ title={`Edit or delete ${k.name}`}
+ aria-label={`Edit or delete ${k.name}`}
+ >
+ <Pencil size={16} />
+ </button>
+ )}
</div>
);
})}
@@ -729,6 +794,121 @@ export const Sidebar: React.FC<SidebarProps> = ({
</button>
</div>
) : null}
+ {memberMenu && (
+ <MemberSheet
+ team={memberMenu.team}
+ kwant={memberMenu.kwant}
+ isLead={memberMenu.kwant.id === memberMenu.team.lead_kwant_id}
+ confirmRemove={!!memberMenu.confirmRemove}
+ onClose={() => setMemberMenu(null)}
+ onChat={() => {
+ setMemberMenu(null);
+ onSelectKwant(memberMenu.kwant);
+ }}
+ onEdit={
+ onEditKwant &&
+ (() => {
+ setMemberMenu(null);
+ onEditKwant(memberMenu.kwant);
+ })
+ }
+ onAskRemove={onUpdateTeamMembers && (() => setMemberMenu({ ...memberMenu, confirmRemove: true }))}
+ onRemove={
+ onUpdateTeamMembers &&
+ (() => {
+ const { team, kwant } = memberMenu;
+ setMemberMenu(null);
+ onUpdateTeamMembers(team, memberIdsOf(team).filter((id) => id !== kwant.id));
+ })
+ }
+ />
+ )}
</aside>
);
};
+
+/** Phones: a team member's actions as a bottom sheet. Removing asks once more, away from the
+ * other buttons, so a stray tap can't take a bot out of its team. */
+const MemberSheet: React.FC<{
+ team: Team;
+ kwant: Kwant;
+ isLead: boolean;
+ confirmRemove: boolean;
+ onClose: () => void;
+ onChat: () => void;
+ onEdit?: () => void;
+ onAskRemove?: () => void;
+ onRemove?: () => void;
+}> = ({ team, kwant, isLead, confirmRemove, onClose, onChat, onEdit, onAskRemove, onRemove }) => {
+ const ref = React.useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose();
+ window.addEventListener('keydown', onKey);
+ return () => window.removeEventListener('keydown', onKey);
+ }, [onClose]);
+ useEffect(() => {
+ ref.current?.querySelector<HTMLElement>('button')?.focus();
+ }, [confirmRemove]);
+ const item = 'w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left text-sm transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400';
+ const titleId = `member-sheet-${kwant.id}`;
+ return (
+ <div className="fixed inset-0 z-50 bg-black/60 flex items-end" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
+ <div
+ ref={ref}
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby={titleId}
+ className="kw-sheet w-full max-h-[80vh] overflow-y-auto rounded-t-2xl bg-zinc-900 border-t border-zinc-800 p-3 shadow-2xl"
+ >
+ <div className="mx-auto mb-2 h-1 w-10 rounded-full bg-zinc-700" aria-hidden="true" />
+ <div className="flex items-center gap-3 px-3 pb-3">
+ <ModernAvatar role={kwant.avatar_sprite} name={kwant.name} size={32} kwantId={kwant.id} />
+ <div className="min-w-0">
+ <p id={titleId} className="text-sm font-semibold text-zinc-100 truncate">{kwant.name}</p>
+ <p className="text-xs text-zinc-500 truncate">
+ {isLead ? `Leads @${team.name}` : `In @${team.name}`}
+ {kwant.title ? ` · ${kwant.title}` : ''}
+ </p>
+ </div>
+ </div>
+ {confirmRemove && onRemove ? (
+ <div className="px-3 pb-1 space-y-3">
+ <p className="text-sm text-zinc-300">
+ Remove {kwant.name} from @{team.name}? The bot stays in this space and keeps its chats.
+ </p>
+ <div className="grid grid-cols-2 gap-2">
+ <button type="button" onClick={onClose} className="rounded-lg border border-zinc-700 px-3 py-2 text-sm text-zinc-200 hover:bg-zinc-800">
+ Cancel
+ </button>
+ <button type="button" onClick={onRemove} className="rounded-lg bg-rose-600 px-3 py-2 text-sm font-medium text-white hover:bg-rose-500">
+ Remove
+ </button>
+ </div>
+ </div>
+ ) : (
+ <div className="space-y-0.5">
+ <button type="button" onClick={onChat} className={`${item} text-zinc-200 hover:bg-zinc-800`}>
+ <MessageSquare size={16} className="text-zinc-400" aria-hidden="true" /> Chat with {kwant.name}
+ </button>
+ {onEdit && (
+ <button type="button" onClick={onEdit} className={`${item} text-zinc-200 hover:bg-zinc-800`}>
+ <Pencil size={16} className="text-zinc-400" aria-hidden="true" /> Edit or delete {kwant.name}
+ </button>
+ )}
+ {onAskRemove && !isLead && (
+ <>
+ <div className="my-1 border-t border-zinc-800" />
+ <button type="button" onClick={onAskRemove} className={`${item} text-rose-300 hover:bg-rose-500/10`}>
+ <UserMinus size={16} aria-hidden="true" /> Remove from @{team.name}
+ </button>
+ </>
+ )}
+ {isLead && (
+ <p className="px-3 pt-1 text-xs text-zinc-500">The lead can&apos;t be removed. Pick another lead in team settings first.</p>
+ )}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+};
diff --git a/frontend/src/components/Spaces.tsx b/frontend/src/components/Spaces.tsx
index 3b0dc83f..be974dab 100644
--- a/frontend/src/components/Spaces.tsx
+++ b/frontend/src/components/Spaces.tsx
@@ -207,12 +207,12 @@ const Dialog: React.FC<{ title: string; subtitle?: string; labelId: string; onCl
return () => window.removeEventListener('keydown', onKey);
}, []);
return (
- <div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-end sm:items-center justify-center sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
+ <div className="kw-dialog kw-dialog-bottom fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-end sm:items-center justify-center sm:p-4" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>
<div
role="dialog"
aria-modal="true"
aria-labelledby={labelId}
- className={`bg-zinc-900 border border-zinc-800 rounded-t-2xl sm:rounded-2xl w-full ${wide ? 'sm:max-w-xl' : 'sm:max-w-md'} max-h-[92vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5`}
+ className={`kw-dialog-panel bg-zinc-900 border border-zinc-800 rounded-t-2xl sm:rounded-2xl w-full ${wide ? 'sm:max-w-xl' : 'sm:max-w-md'} max-h-[92vh] overflow-y-auto p-4 sm:p-6 text-zinc-100 shadow-2xl space-y-5`}
>
<div className="flex items-start justify-between gap-3">
<div>
@@ -306,7 +306,7 @@ export const NewSpaceModal: React.FC<NewSpaceProps> = ({ spaces, onClose, onCrea
aria-pressed={icon === i}
aria-label={`Icon ${i}`}
onClick={() => setIcon(i)}
- className={`w-9 h-9 rounded-lg text-lg flex items-center justify-center border transition-colors ${
+ className={`w-11 h-11 sm:w-9 sm:h-9 rounded-lg text-lg flex items-center justify-center border transition-colors ${
icon === i ? 'border-sky-400 bg-sky-500/10' : 'border-zinc-800 hover:border-zinc-600'
}`}
>
diff --git a/frontend/src/styles/modern.css b/frontend/src/styles/modern.css
index 6bac2e65..66b11ff4 100644
--- a/frontend/src/styles/modern.css
+++ b/frontend/src/styles/modern.css
@@ -151,7 +151,7 @@
min-height: 44px;
}
/* Icon-only buttons get the width too, with the icon centred */
- button:not([role='switch'], [data-compact], .hidden, :has(> :not(svg, img))):has(> svg, > img) {
+ button:not([role='switch'], [role='menuitem'], [data-compact], .hidden, .w-full, :has(> :not(svg, img, .sr-only, .hidden))):has(> svg, > img) {
min-width: 44px;
display: inline-flex;
align-items: center;
@@ -168,7 +168,8 @@
input:not([type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file']),
textarea,
select {
- font-size: 16px;
+ /* !important: text-sm / text-xs utilities would otherwise win and iOS zooms on focus */
+ font-size: 16px !important;
}
}
@@ -195,3 +196,45 @@
box-shadow: none;
}
}
+
+/* Pinned sidebar section titles on phones: the sidebar's own colour, so rows scroll under them */
+.kw-sticky-head {
+ background: linear-gradient(theme('colors.zinc.900 / 40%'), theme('colors.zinc.900 / 40%')), theme('colors.zinc.950');
+}
+
+/* Bottom sheets clear the home indicator */
+.kw-sheet {
+ padding-bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 0.75rem));
+}
+
+/* Phone-width dialogs: forms open as full-height pages that clear the notch and home indicator,
+ and short confirms as bottom sheets. Desktop and tablets keep the centred card. */
+@media (max-width: 639px) {
+ .kw-dialog.kw-dialog {
+ padding: 0;
+ align-items: stretch;
+ justify-content: stretch;
+ }
+ .kw-dialog > .kw-dialog-panel {
+ width: 100%;
+ max-width: none;
+ height: var(--kwnt-app-height, 100dvh);
+ max-height: none;
+ border-width: 0;
+ border-radius: 0;
+ overflow-y: auto;
+ overscroll-behavior: contain;
+ padding-top: calc(env(safe-area-inset-top) + 1rem);
+ padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
+ }
+ .kw-dialog.kw-dialog-bottom {
+ align-items: flex-end;
+ }
+ .kw-dialog-bottom > .kw-dialog-panel {
+ height: auto;
+ max-height: 90dvh;
+ border-top-width: 1px;
+ border-radius: 1rem 1rem 0 0;
+ padding-top: 1rem;
+ }
+}