fix: mobile position
This commit is contained in:
parent
7b8c8ec5e8
commit
78bff3f2ed
|
|
@ -141,13 +141,13 @@ export function ApiKeyWidget() {
|
|||
{ui.expanded && (
|
||||
<div className={`bg-slate-900/95 backdrop-blur-sm border border-slate-700 rounded-xl shadow-2xl animate-in fade-in duration-200 ${
|
||||
isMobileContext
|
||||
? 'absolute top-0 left-0 right-0 p-4 z-50' // Mobile: absolute positioned, top-aligned
|
||||
? 'fixed inset-x-4 top-16 p-5 z-50 max-h-[calc(100vh-6rem)] overflow-y-auto' // Mobile: fixed positioning for full-width
|
||||
: 'absolute top-0 right-0 w-96 p-5 z-50' // Desktop: absolute positioned
|
||||
}`}>
|
||||
{/* Header */}
|
||||
<div className="flex items-start justify-between mb-4">
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-white mb-1">
|
||||
<h3 className={`font-semibold text-white mb-1 ${isMobileContext ? 'text-base' : 'text-sm'}`}>
|
||||
{apiKeyValidated ? 'API Key Active' : 'Enter API Key'}
|
||||
</h3>
|
||||
{apiKeyValidated && apiKeyInfo && (
|
||||
|
|
@ -158,10 +158,12 @@ export function ApiKeyWidget() {
|
|||
</div>
|
||||
<button
|
||||
onClick={() => setExpanded(false)}
|
||||
className="w-8 h-8 rounded-lg bg-slate-800 hover:bg-slate-700 text-gray-400 hover:text-white flex items-center justify-center transition-colors"
|
||||
className={`rounded-lg bg-slate-800 hover:bg-slate-700 text-gray-400 hover:text-white flex items-center justify-center transition-colors ${
|
||||
isMobileContext ? 'w-10 h-10' : 'w-8 h-8'
|
||||
}`}
|
||||
aria-label="Minimize API key details"
|
||||
>
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg className={isMobileContext ? 'w-5 h-5' : 'w-4 h-4'} fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
|
|
@ -173,9 +175,9 @@ export function ApiKeyWidget() {
|
|||
</div>
|
||||
|
||||
{/* API Key Input/Display */}
|
||||
<div className="mb-3">
|
||||
<label className="text-xs text-gray-500 mb-1.5 block">API Key</label>
|
||||
<div className="flex gap-2">
|
||||
<div className="mb-4">
|
||||
<label className="text-xs text-gray-500 mb-2 block">API Key</label>
|
||||
<div className={`flex gap-2 ${isMobileContext ? 'flex-col' : 'flex-row'}`}>
|
||||
<input
|
||||
ref={inputRef}
|
||||
type={ui.keyVisible ? 'text' : 'password'}
|
||||
|
|
@ -184,37 +186,47 @@ export function ApiKeyWidget() {
|
|||
onKeyDown={handleKeyDown}
|
||||
placeholder="Enter your API key"
|
||||
disabled={apiKeyValidated}
|
||||
className="flex-1 px-3 py-2 bg-slate-800 border border-slate-700 rounded-lg text-sm text-gray-300 font-mono placeholder:text-gray-600 focus:outline-none focus:ring-2 focus:ring-purple-500/50 focus:border-purple-500 disabled:opacity-50 disabled:cursor-not-allowed transition-all"
|
||||
className={`flex-1 px-4 bg-slate-800 border border-slate-700 rounded-lg text-gray-300 font-mono placeholder:text-gray-600 focus:outline-none focus:ring-2 focus:ring-purple-500/50 focus:border-purple-500 disabled:opacity-50 disabled:cursor-not-allowed transition-all ${
|
||||
isMobileContext ? 'py-3 text-base' : 'py-2 text-sm'
|
||||
}`}
|
||||
/>
|
||||
<button
|
||||
onClick={toggleKeyVisibility}
|
||||
className="px-3 py-2 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-lg text-gray-400 hover:text-white transition-colors"
|
||||
className={`bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-lg text-gray-400 hover:text-white transition-colors ${
|
||||
isMobileContext ? 'px-4 py-3 w-full justify-center flex items-center gap-2' : 'px-3 py-2'
|
||||
}`}
|
||||
aria-label={ui.keyVisible ? 'Hide API key' : 'Show API key'}
|
||||
>
|
||||
{ui.keyVisible ? (
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"
|
||||
/>
|
||||
</svg>
|
||||
<>
|
||||
<svg className={isMobileContext ? 'w-5 h-5' : 'w-4 h-4'} fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"
|
||||
/>
|
||||
</svg>
|
||||
{isMobileContext && <span className="text-sm font-medium">Hide</span>}
|
||||
</>
|
||||
) : (
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
||||
/>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
|
||||
/>
|
||||
</svg>
|
||||
<>
|
||||
<svg className={isMobileContext ? 'w-5 h-5' : 'w-4 h-4'} fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
||||
/>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
|
||||
/>
|
||||
</svg>
|
||||
{isMobileContext && <span className="text-sm font-medium">Show</span>}
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -222,7 +234,7 @@ export function ApiKeyWidget() {
|
|||
|
||||
{/* Error Message */}
|
||||
{apiKeyError && (
|
||||
<div className="mb-3 p-2 bg-red-900/20 border border-red-700/50 rounded-lg">
|
||||
<div className={`mb-3 bg-red-900/20 border border-red-700/50 rounded-lg ${isMobileContext ? 'p-3' : 'p-2'}`}>
|
||||
<p className="text-xs text-red-400">{apiKeyError}</p>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -233,12 +245,14 @@ export function ApiKeyWidget() {
|
|||
<button
|
||||
onClick={validateApiKey}
|
||||
disabled={validatingKey || !apiKey.trim()}
|
||||
className="flex-1 px-4 py-2 bg-purple-600 hover:bg-purple-700 disabled:bg-slate-700 disabled:text-gray-500 disabled:cursor-not-allowed border border-purple-500 disabled:border-slate-600 rounded-lg text-white text-sm font-medium transition-colors"
|
||||
className={`flex-1 bg-purple-600 hover:bg-purple-700 disabled:bg-slate-700 disabled:text-gray-500 disabled:cursor-not-allowed border border-purple-500 disabled:border-slate-600 rounded-lg text-white font-medium transition-colors ${
|
||||
isMobileContext ? 'px-5 py-3.5 text-base' : 'px-4 py-2 text-sm'
|
||||
}`}
|
||||
>
|
||||
{validatingKey ? (
|
||||
<span className="flex items-center justify-center gap-2">
|
||||
<svg
|
||||
className="animate-spin h-4 w-4"
|
||||
className={isMobileContext ? 'animate-spin h-5 w-5' : 'animate-spin h-4 w-4'}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
|
|
@ -266,7 +280,9 @@ export function ApiKeyWidget() {
|
|||
) : (
|
||||
<button
|
||||
onClick={() => revokeApiKey()}
|
||||
className="flex-1 px-4 py-2 bg-red-900/20 hover:bg-red-900/30 border border-red-700/50 hover:border-red-600 rounded-lg text-red-400 text-sm font-medium transition-colors"
|
||||
className={`flex-1 bg-red-900/20 hover:bg-red-900/30 border border-red-700/50 hover:border-red-600 rounded-lg text-red-400 font-medium transition-colors ${
|
||||
isMobileContext ? 'px-5 py-3.5 text-base' : 'px-4 py-2 text-sm'
|
||||
}`}
|
||||
>
|
||||
Revoke & Use Different Key
|
||||
</button>
|
||||
|
|
@ -275,7 +291,7 @@ export function ApiKeyWidget() {
|
|||
|
||||
{/* Helper Text */}
|
||||
{!apiKeyValidated && (
|
||||
<p className="mt-3 text-xs text-gray-500 text-center">
|
||||
<p className={`mt-3 text-gray-500 text-center ${isMobileContext ? 'text-sm' : 'text-xs'}`}>
|
||||
Press Enter or click Validate to verify your API key
|
||||
</p>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Reference in New Issue