feat: improve mobile image generation UX
Browse files
web/src/app/image/components/image-composer.tsx
CHANGED
|
@@ -6,11 +6,9 @@ import { ImageLightbox } from "@/components/image-lightbox";
|
|
| 6 |
import { Button } from "@/components/ui/button";
|
| 7 |
import { Input } from "@/components/ui/input";
|
| 8 |
import { Textarea } from "@/components/ui/textarea";
|
| 9 |
-
import type { ImageConversationMode } from "@/store/image-conversations";
|
| 10 |
import { cn } from "@/lib/utils";
|
| 11 |
|
| 12 |
type ImageComposerProps = {
|
| 13 |
-
mode: ImageConversationMode;
|
| 14 |
prompt: string;
|
| 15 |
imageCount: string;
|
| 16 |
imageSize: string;
|
|
@@ -19,7 +17,6 @@ type ImageComposerProps = {
|
|
| 19 |
referenceImages: Array<{ name: string; dataUrl: string }>;
|
| 20 |
textareaRef: RefObject<HTMLTextAreaElement | null>;
|
| 21 |
fileInputRef: RefObject<HTMLInputElement | null>;
|
| 22 |
-
onModeChange: (value: ImageConversationMode) => void;
|
| 23 |
onPromptChange: (value: string) => void;
|
| 24 |
onImageCountChange: (value: string) => void;
|
| 25 |
onImageSizeChange: (value: string) => void;
|
|
@@ -30,7 +27,6 @@ type ImageComposerProps = {
|
|
| 30 |
};
|
| 31 |
|
| 32 |
export function ImageComposer({
|
| 33 |
-
mode,
|
| 34 |
prompt,
|
| 35 |
imageCount,
|
| 36 |
imageSize,
|
|
@@ -39,7 +35,6 @@ export function ImageComposer({
|
|
| 39 |
referenceImages,
|
| 40 |
textareaRef,
|
| 41 |
fileInputRef,
|
| 42 |
-
onModeChange,
|
| 43 |
onPromptChange,
|
| 44 |
onImageCountChange,
|
| 45 |
onImageSizeChange,
|
|
@@ -92,32 +87,30 @@ export function ImageComposer({
|
|
| 92 |
};
|
| 93 |
|
| 94 |
return (
|
| 95 |
-
<div className="shrink-0 flex justify-center">
|
| 96 |
<div style={{ width: "min(980px, 100%)" }}>
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
/>
|
| 108 |
-
)}
|
| 109 |
|
| 110 |
-
{
|
| 111 |
-
<div className="mb-
|
| 112 |
{referenceImages.map((image, index) => (
|
| 113 |
-
<div key={`${image.name}-${index}`} className="relative size-16">
|
| 114 |
<button
|
| 115 |
type="button"
|
| 116 |
onClick={() => {
|
| 117 |
setLightboxIndex(index);
|
| 118 |
setLightboxOpen(true);
|
| 119 |
}}
|
| 120 |
-
className="group size-
|
| 121 |
aria-label={`预览参考图 ${image.name || index + 1}`}
|
| 122 |
>
|
| 123 |
<img
|
|
@@ -142,7 +135,7 @@ export function ImageComposer({
|
|
| 142 |
</div>
|
| 143 |
) : null}
|
| 144 |
|
| 145 |
-
<div className="rounded-[
|
| 146 |
<div
|
| 147 |
className="relative cursor-text"
|
| 148 |
onClick={() => {
|
|
@@ -162,7 +155,9 @@ export function ImageComposer({
|
|
| 162 |
onChange={(event) => onPromptChange(event.target.value)}
|
| 163 |
onPaste={handleTextareaPaste}
|
| 164 |
placeholder={
|
| 165 |
-
|
|
|
|
|
|
|
| 166 |
}
|
| 167 |
onKeyDown={(event) => {
|
| 168 |
if (event.key === "Enter" && !event.shiftKey) {
|
|
@@ -170,37 +165,35 @@ export function ImageComposer({
|
|
| 170 |
void onSubmit();
|
| 171 |
}
|
| 172 |
}}
|
| 173 |
-
className="min-h-[
|
| 174 |
/>
|
| 175 |
|
| 176 |
-
<div className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-white via-white/95 to-transparent px-
|
| 177 |
-
<div className="flex items-end justify-between gap-3">
|
| 178 |
-
<div className="flex min-w-0 flex-1 flex-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
>
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
</Button>
|
| 190 |
-
)}
|
| 191 |
-
<div className="rounded-full bg-stone-100 px-2 py-1 text-[10px] font-medium text-stone-600 sm:px-3 sm:py-2 sm:text-xs">
|
| 192 |
<span className="hidden xs:inline">剩余额度 </span>{availableQuota}
|
| 193 |
</div>
|
| 194 |
{activeTaskCount > 0 && (
|
| 195 |
-
<div className="flex items-center gap-1 rounded-full bg-amber-50 px-2 py-1 text-[10px] font-medium text-amber-700 sm:gap-1.5 sm:px-3 sm:py-2 sm:text-xs">
|
| 196 |
<LoaderCircle className="size-3 animate-spin" />
|
| 197 |
{activeTaskCount}<span className="hidden sm:inline"> 个任务处理中</span>
|
| 198 |
</div>
|
| 199 |
)}
|
| 200 |
-
<div className="flex items-center gap-1.5 rounded-full border border-stone-200 bg-white px-2 py-0.5 sm:gap-2 sm:px-3 sm:py-1">
|
| 201 |
<span className="text-[11px] font-medium text-stone-700 sm:text-sm">张数</span>
|
| 202 |
<Input
|
| 203 |
type="number"
|
|
|
|
| 204 |
min="1"
|
| 205 |
max="10"
|
| 206 |
step="1"
|
|
@@ -211,19 +204,19 @@ export function ImageComposer({
|
|
| 211 |
</div>
|
| 212 |
<div
|
| 213 |
ref={sizeMenuRef}
|
| 214 |
-
className="relative flex items-center gap-1.5 rounded-full border border-stone-200 bg-white px-2 py-0.5 text-[11px] sm:gap-2 sm:px-3 sm:py-1 sm:text-[13px]"
|
| 215 |
>
|
| 216 |
<span className="font-medium text-stone-700 sm:text-sm">比例</span>
|
| 217 |
<button
|
| 218 |
type="button"
|
| 219 |
-
className="flex h-7 w-[
|
| 220 |
onClick={() => setIsSizeMenuOpen((open) => !open)}
|
| 221 |
>
|
| 222 |
<span className="truncate">{imageSizeLabel}</span>
|
| 223 |
<ChevronDown className={cn("size-4 shrink-0 opacity-60 transition", isSizeMenuOpen && "rotate-180")} />
|
| 224 |
</button>
|
| 225 |
{isSizeMenuOpen ? (
|
| 226 |
-
<div className="
|
| 227 |
{imageSizeOptions.map((option) => {
|
| 228 |
const active = option.value === imageSize;
|
| 229 |
return (
|
|
@@ -248,22 +241,14 @@ export function ImageComposer({
|
|
| 248 |
) : null}
|
| 249 |
</div>
|
| 250 |
|
| 251 |
-
<div className="flex items-center gap-1.5 sm:gap-2">
|
| 252 |
-
<ModeButton active={mode === "generate"} onClick={() => onModeChange("generate")}>
|
| 253 |
-
文生图
|
| 254 |
-
</ModeButton>
|
| 255 |
-
<ModeButton active={mode === "edit"} onClick={() => onModeChange("edit")}>
|
| 256 |
-
图生图
|
| 257 |
-
</ModeButton>
|
| 258 |
-
</div>
|
| 259 |
</div>
|
| 260 |
|
| 261 |
<button
|
| 262 |
type="button"
|
| 263 |
onClick={() => void onSubmit()}
|
| 264 |
-
disabled={!prompt.trim()
|
| 265 |
-
className="inline-flex size-
|
| 266 |
-
aria-label={
|
| 267 |
>
|
| 268 |
<ArrowUp className="size-3.5 sm:size-4" />
|
| 269 |
</button>
|
|
@@ -276,25 +261,3 @@ export function ImageComposer({
|
|
| 276 |
);
|
| 277 |
}
|
| 278 |
|
| 279 |
-
function ModeButton({
|
| 280 |
-
active,
|
| 281 |
-
children,
|
| 282 |
-
onClick,
|
| 283 |
-
}: {
|
| 284 |
-
active: boolean;
|
| 285 |
-
children: string;
|
| 286 |
-
onClick: () => void;
|
| 287 |
-
}) {
|
| 288 |
-
return (
|
| 289 |
-
<button
|
| 290 |
-
type="button"
|
| 291 |
-
onClick={onClick}
|
| 292 |
-
className={cn(
|
| 293 |
-
"rounded-full px-2.5 py-1.5 text-xs font-medium transition sm:px-4 sm:py-2 sm:text-sm",
|
| 294 |
-
active ? "bg-stone-950 text-white" : "bg-stone-100 text-stone-600 hover:bg-stone-200",
|
| 295 |
-
)}
|
| 296 |
-
>
|
| 297 |
-
{children}
|
| 298 |
-
</button>
|
| 299 |
-
);
|
| 300 |
-
}
|
|
|
|
| 6 |
import { Button } from "@/components/ui/button";
|
| 7 |
import { Input } from "@/components/ui/input";
|
| 8 |
import { Textarea } from "@/components/ui/textarea";
|
|
|
|
| 9 |
import { cn } from "@/lib/utils";
|
| 10 |
|
| 11 |
type ImageComposerProps = {
|
|
|
|
| 12 |
prompt: string;
|
| 13 |
imageCount: string;
|
| 14 |
imageSize: string;
|
|
|
|
| 17 |
referenceImages: Array<{ name: string; dataUrl: string }>;
|
| 18 |
textareaRef: RefObject<HTMLTextAreaElement | null>;
|
| 19 |
fileInputRef: RefObject<HTMLInputElement | null>;
|
|
|
|
| 20 |
onPromptChange: (value: string) => void;
|
| 21 |
onImageCountChange: (value: string) => void;
|
| 22 |
onImageSizeChange: (value: string) => void;
|
|
|
|
| 27 |
};
|
| 28 |
|
| 29 |
export function ImageComposer({
|
|
|
|
| 30 |
prompt,
|
| 31 |
imageCount,
|
| 32 |
imageSize,
|
|
|
|
| 35 |
referenceImages,
|
| 36 |
textareaRef,
|
| 37 |
fileInputRef,
|
|
|
|
| 38 |
onPromptChange,
|
| 39 |
onImageCountChange,
|
| 40 |
onImageSizeChange,
|
|
|
|
| 87 |
};
|
| 88 |
|
| 89 |
return (
|
| 90 |
+
<div className="shrink-0 flex justify-center px-1 sm:px-0">
|
| 91 |
<div style={{ width: "min(980px, 100%)" }}>
|
| 92 |
+
<input
|
| 93 |
+
ref={fileInputRef}
|
| 94 |
+
type="file"
|
| 95 |
+
accept="image/*"
|
| 96 |
+
multiple
|
| 97 |
+
className="hidden"
|
| 98 |
+
onChange={(event) => {
|
| 99 |
+
void onReferenceImageChange(Array.from(event.target.files || []));
|
| 100 |
+
}}
|
| 101 |
+
/>
|
|
|
|
|
|
|
| 102 |
|
| 103 |
+
{referenceImages.length > 0 ? (
|
| 104 |
+
<div className="mb-2 flex gap-2 overflow-x-auto px-1 pb-1 sm:mb-3 sm:flex-wrap sm:overflow-visible sm:pb-0">
|
| 105 |
{referenceImages.map((image, index) => (
|
| 106 |
+
<div key={`${image.name}-${index}`} className="relative size-14 shrink-0 sm:size-16">
|
| 107 |
<button
|
| 108 |
type="button"
|
| 109 |
onClick={() => {
|
| 110 |
setLightboxIndex(index);
|
| 111 |
setLightboxOpen(true);
|
| 112 |
}}
|
| 113 |
+
className="group size-14 overflow-hidden rounded-2xl border border-stone-200 bg-stone-50 transition hover:border-stone-300 sm:size-16"
|
| 114 |
aria-label={`预览参考图 ${image.name || index + 1}`}
|
| 115 |
>
|
| 116 |
<img
|
|
|
|
| 135 |
</div>
|
| 136 |
) : null}
|
| 137 |
|
| 138 |
+
<div className="rounded-[24px] border border-stone-200 bg-white shadow-[0_14px_60px_-42px_rgba(15,23,42,0.45)] sm:rounded-[32px] sm:shadow-none">
|
| 139 |
<div
|
| 140 |
className="relative cursor-text"
|
| 141 |
onClick={() => {
|
|
|
|
| 155 |
onChange={(event) => onPromptChange(event.target.value)}
|
| 156 |
onPaste={handleTextareaPaste}
|
| 157 |
placeholder={
|
| 158 |
+
referenceImages.length > 0
|
| 159 |
+
? "描述你希望如何修改参考图"
|
| 160 |
+
: "输入你想要生成的画面,也可直接粘贴图片"
|
| 161 |
}
|
| 162 |
onKeyDown={(event) => {
|
| 163 |
if (event.key === "Enter" && !event.shiftKey) {
|
|
|
|
| 165 |
void onSubmit();
|
| 166 |
}
|
| 167 |
}}
|
| 168 |
+
className="min-h-[82px] resize-none rounded-[24px] border-0 bg-transparent px-4 pt-4 pb-2 text-[15px] leading-6 text-stone-900 shadow-none placeholder:text-stone-400 focus-visible:ring-0 sm:min-h-[148px] sm:rounded-[32px] sm:px-6 sm:pt-6 sm:pb-20 sm:leading-7"
|
| 169 |
/>
|
| 170 |
|
| 171 |
+
<div className="border-t border-stone-100 bg-white px-3 pb-3 pt-2 sm:absolute sm:inset-x-0 sm:bottom-0 sm:border-t-0 sm:bg-gradient-to-t sm:from-white sm:via-white/95 sm:to-transparent sm:px-6 sm:pb-4 sm:pt-6">
|
| 172 |
+
<div className="flex items-end justify-between gap-2 sm:gap-3">
|
| 173 |
+
<div className="hide-scrollbar flex min-w-0 flex-1 flex-nowrap items-center gap-1.5 overflow-x-auto pb-0.5 sm:flex-wrap sm:gap-3 sm:overflow-visible sm:pb-0">
|
| 174 |
+
<Button
|
| 175 |
+
type="button"
|
| 176 |
+
variant="outline"
|
| 177 |
+
className="h-9 shrink-0 rounded-full border-stone-200 bg-white px-3 text-xs font-medium text-stone-700 shadow-none sm:h-10 sm:px-4 sm:text-sm"
|
| 178 |
+
onClick={onPickReferenceImage}
|
| 179 |
+
>
|
| 180 |
+
<ImagePlus className="size-3.5 sm:size-4" />
|
| 181 |
+
<span>{referenceImages.length > 0 ? "添加参考图" : "上传"}</span>
|
| 182 |
+
</Button>
|
| 183 |
+
<div className="shrink-0 rounded-full bg-stone-100 px-2 py-1 text-[10px] font-medium text-stone-600 sm:px-3 sm:py-2 sm:text-xs">
|
|
|
|
|
|
|
|
|
|
| 184 |
<span className="hidden xs:inline">剩余额度 </span>{availableQuota}
|
| 185 |
</div>
|
| 186 |
{activeTaskCount > 0 && (
|
| 187 |
+
<div className="flex shrink-0 items-center gap-1 rounded-full bg-amber-50 px-2 py-1 text-[10px] font-medium text-amber-700 sm:gap-1.5 sm:px-3 sm:py-2 sm:text-xs">
|
| 188 |
<LoaderCircle className="size-3 animate-spin" />
|
| 189 |
{activeTaskCount}<span className="hidden sm:inline"> 个任务处理中</span>
|
| 190 |
</div>
|
| 191 |
)}
|
| 192 |
+
<div className="flex h-9 shrink-0 items-center gap-1.5 rounded-full border border-stone-200 bg-white px-2 py-0.5 sm:h-auto sm:gap-2 sm:px-3 sm:py-1">
|
| 193 |
<span className="text-[11px] font-medium text-stone-700 sm:text-sm">张数</span>
|
| 194 |
<Input
|
| 195 |
type="number"
|
| 196 |
+
inputMode="numeric"
|
| 197 |
min="1"
|
| 198 |
max="10"
|
| 199 |
step="1"
|
|
|
|
| 204 |
</div>
|
| 205 |
<div
|
| 206 |
ref={sizeMenuRef}
|
| 207 |
+
className="relative flex h-9 shrink-0 items-center gap-1.5 rounded-full border border-stone-200 bg-white px-2 py-0.5 text-[11px] sm:h-auto sm:gap-2 sm:px-3 sm:py-1 sm:text-[13px]"
|
| 208 |
>
|
| 209 |
<span className="font-medium text-stone-700 sm:text-sm">比例</span>
|
| 210 |
<button
|
| 211 |
type="button"
|
| 212 |
+
className="flex h-7 w-[78px] items-center justify-between bg-transparent text-left text-xs font-bold text-stone-700 min-[390px]:w-[96px] sm:h-8 sm:w-[132px]"
|
| 213 |
onClick={() => setIsSizeMenuOpen((open) => !open)}
|
| 214 |
>
|
| 215 |
<span className="truncate">{imageSizeLabel}</span>
|
| 216 |
<ChevronDown className={cn("size-4 shrink-0 opacity-60 transition", isSizeMenuOpen && "rotate-180")} />
|
| 217 |
</button>
|
| 218 |
{isSizeMenuOpen ? (
|
| 219 |
+
<div className="fixed inset-x-4 bottom-[calc(env(safe-area-inset-bottom)+5.75rem)] z-[80] max-h-[45dvh] overflow-y-auto rounded-3xl border border-white/80 bg-white p-2 shadow-[0_24px_80px_-32px_rgba(15,23,42,0.35)] sm:absolute sm:inset-x-auto sm:bottom-[calc(100%+10px)] sm:left-0 sm:w-[186px]">
|
| 220 |
{imageSizeOptions.map((option) => {
|
| 221 |
const active = option.value === imageSize;
|
| 222 |
return (
|
|
|
|
| 241 |
) : null}
|
| 242 |
</div>
|
| 243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
</div>
|
| 245 |
|
| 246 |
<button
|
| 247 |
type="button"
|
| 248 |
onClick={() => void onSubmit()}
|
| 249 |
+
disabled={!prompt.trim()}
|
| 250 |
+
className="inline-flex size-10 shrink-0 items-center justify-center rounded-full bg-stone-950 text-white transition hover:bg-stone-800 disabled:cursor-not-allowed disabled:bg-stone-300 sm:size-11"
|
| 251 |
+
aria-label={referenceImages.length > 0 ? "编辑图片" : "生成图片"}
|
| 252 |
>
|
| 253 |
<ArrowUp className="size-3.5 sm:size-4" />
|
| 254 |
</button>
|
|
|
|
| 261 |
);
|
| 262 |
}
|
| 263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
web/src/app/image/components/image-results.tsx
CHANGED
|
@@ -41,10 +41,10 @@ export function ImageResults({
|
|
| 41 |
|
| 42 |
if (!selectedConversation) {
|
| 43 |
return (
|
| 44 |
-
<div className="flex h-full min-h-[
|
| 45 |
<div className="w-full max-w-4xl">
|
| 46 |
<h1
|
| 47 |
-
className="text-
|
| 48 |
style={{
|
| 49 |
fontFamily: '"Palatino Linotype","Book Antiqua","URW Palladio L","Times New Roman",serif',
|
| 50 |
}}
|
|
@@ -52,7 +52,7 @@ export function ImageResults({
|
|
| 52 |
Turn ideas into images
|
| 53 |
</h1>
|
| 54 |
<p
|
| 55 |
-
className="mt-
|
| 56 |
style={{
|
| 57 |
fontFamily: '"Palatino Linotype","Book Antiqua","URW Palladio L","Times New Roman",serif',
|
| 58 |
}}
|
|
@@ -65,7 +65,7 @@ export function ImageResults({
|
|
| 65 |
}
|
| 66 |
|
| 67 |
return (
|
| 68 |
-
<div className="mx-auto flex w-full max-w-[980px] flex-col gap-8">
|
| 69 |
{selectedConversation.turns.map((turn, turnIndex) => {
|
| 70 |
const referenceLightboxImages = turn.referenceImages.map((image, index) => ({
|
| 71 |
id: `${turn.id}-reference-${index}`,
|
|
@@ -85,10 +85,10 @@ export function ImageResults({
|
|
| 85 |
);
|
| 86 |
|
| 87 |
return (
|
| 88 |
-
<div key={turn.id} className="flex flex-col gap-4">
|
| 89 |
<div className="flex justify-end">
|
| 90 |
-
<div className="max-w-[
|
| 91 |
-
<div className="mb-
|
| 92 |
<span>第 {turnIndex + 1} 轮</span>
|
| 93 |
<span>
|
| 94 |
{turn.mode === "edit" ? "编辑图" : "文生图"}
|
|
@@ -135,7 +135,7 @@ export function ImageResults({
|
|
| 135 |
</div>
|
| 136 |
) : null}
|
| 137 |
|
| 138 |
-
<div className="mb-
|
| 139 |
<span className="rounded-full bg-stone-100 px-3 py-1">{turn.count} 张</span>
|
| 140 |
<span className="rounded-full bg-stone-100 px-3 py-1">{getTurnStatusLabel(turn.status)}</span>
|
| 141 |
{turn.status === "queued" ? (
|
|
@@ -143,7 +143,7 @@ export function ImageResults({
|
|
| 143 |
) : null}
|
| 144 |
</div>
|
| 145 |
|
| 146 |
-
<div className="columns-1 gap-
|
| 147 |
{turn.images.map((image, index) => {
|
| 148 |
if (image.status === "success" && image.b64_json) {
|
| 149 |
const currentIndex = successfulTurnImages.findIndex((item) => item.id === image.id);
|
|
@@ -198,16 +198,16 @@ export function ImageResults({
|
|
| 198 |
<div
|
| 199 |
key={image.id}
|
| 200 |
className={cn(
|
| 201 |
-
"break-inside-avoid overflow-hidden border border-rose-200 bg-rose-50",
|
| 202 |
-
turn.size === "1:1" && "aspect-square",
|
| 203 |
-
turn.size === "16:9" && "aspect-video",
|
| 204 |
-
turn.size === "9:16" && "aspect-[9/16]",
|
| 205 |
-
turn.size === "4:3" && "aspect-[4/3]",
|
| 206 |
-
turn.size === "3:4" && "aspect-[3/4]",
|
| 207 |
-
!["1:1", "16:9", "9:16", "4:3", "3:4"].includes(turn.size) && "aspect-square",
|
| 208 |
)}
|
| 209 |
>
|
| 210 |
-
<div className="flex h-full items-center justify-center px-
|
| 211 |
{image.error || "生成失败"}
|
| 212 |
</div>
|
| 213 |
</div>
|
|
|
|
| 41 |
|
| 42 |
if (!selectedConversation) {
|
| 43 |
return (
|
| 44 |
+
<div className="flex h-full min-h-[260px] items-center justify-center text-center sm:min-h-[420px]">
|
| 45 |
<div className="w-full max-w-4xl">
|
| 46 |
<h1
|
| 47 |
+
className="text-2xl font-semibold tracking-tight text-stone-950 sm:text-3xl md:text-5xl"
|
| 48 |
style={{
|
| 49 |
fontFamily: '"Palatino Linotype","Book Antiqua","URW Palladio L","Times New Roman",serif',
|
| 50 |
}}
|
|
|
|
| 52 |
Turn ideas into images
|
| 53 |
</h1>
|
| 54 |
<p
|
| 55 |
+
className="mx-auto mt-3 max-w-[280px] text-sm italic tracking-[0.01em] text-stone-500 sm:mt-4 sm:max-w-none sm:text-[15px]"
|
| 56 |
style={{
|
| 57 |
fontFamily: '"Palatino Linotype","Book Antiqua","URW Palladio L","Times New Roman",serif',
|
| 58 |
}}
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
return (
|
| 68 |
+
<div className="mx-auto flex w-full max-w-[980px] flex-col gap-5 sm:gap-8">
|
| 69 |
{selectedConversation.turns.map((turn, turnIndex) => {
|
| 70 |
const referenceLightboxImages = turn.referenceImages.map((image, index) => ({
|
| 71 |
id: `${turn.id}-reference-${index}`,
|
|
|
|
| 85 |
);
|
| 86 |
|
| 87 |
return (
|
| 88 |
+
<div key={turn.id} className="flex flex-col gap-3 sm:gap-4">
|
| 89 |
<div className="flex justify-end">
|
| 90 |
+
<div className="max-w-[90%] px-1 py-1 text-[14px] leading-6 text-stone-900 sm:max-w-[82%] sm:text-[15px] sm:leading-7">
|
| 91 |
+
<div className="mb-1.5 flex flex-wrap justify-end gap-2 text-[11px] text-stone-400 sm:mb-2">
|
| 92 |
<span>第 {turnIndex + 1} 轮</span>
|
| 93 |
<span>
|
| 94 |
{turn.mode === "edit" ? "编辑图" : "文生图"}
|
|
|
|
| 135 |
</div>
|
| 136 |
) : null}
|
| 137 |
|
| 138 |
+
<div className="mb-3 flex flex-wrap items-center gap-1.5 text-[11px] text-stone-500 sm:mb-4 sm:gap-2 sm:text-xs">
|
| 139 |
<span className="rounded-full bg-stone-100 px-3 py-1">{turn.count} 张</span>
|
| 140 |
<span className="rounded-full bg-stone-100 px-3 py-1">{getTurnStatusLabel(turn.status)}</span>
|
| 141 |
{turn.status === "queued" ? (
|
|
|
|
| 143 |
) : null}
|
| 144 |
</div>
|
| 145 |
|
| 146 |
+
<div className="columns-1 gap-3 space-y-3 sm:columns-2 sm:gap-4 sm:space-y-4 xl:columns-3">
|
| 147 |
{turn.images.map((image, index) => {
|
| 148 |
if (image.status === "success" && image.b64_json) {
|
| 149 |
const currentIndex = successfulTurnImages.findIndex((item) => item.id === image.id);
|
|
|
|
| 198 |
<div
|
| 199 |
key={image.id}
|
| 200 |
className={cn(
|
| 201 |
+
"break-inside-avoid overflow-hidden rounded-2xl border border-rose-200 bg-rose-50 sm:rounded-none",
|
| 202 |
+
turn.size === "1:1" && "sm:aspect-square",
|
| 203 |
+
turn.size === "16:9" && "sm:aspect-video",
|
| 204 |
+
turn.size === "9:16" && "sm:aspect-[9/16]",
|
| 205 |
+
turn.size === "4:3" && "sm:aspect-[4/3]",
|
| 206 |
+
turn.size === "3:4" && "sm:aspect-[3/4]",
|
| 207 |
+
!["1:1", "16:9", "9:16", "4:3", "3:4"].includes(turn.size) && "sm:aspect-square",
|
| 208 |
)}
|
| 209 |
>
|
| 210 |
+
<div className="flex h-full min-h-16 items-center justify-center px-4 py-4 text-center text-sm leading-6 text-rose-600 sm:px-6 sm:py-8">
|
| 211 |
{image.error || "生成失败"}
|
| 212 |
</div>
|
| 213 |
</div>
|
web/src/app/image/components/image-sidebar.tsx
CHANGED
|
@@ -49,7 +49,12 @@ export function ImageSidebar({
|
|
| 49 |
</div>
|
| 50 |
)}
|
| 51 |
|
| 52 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
{isLoadingHistory ? (
|
| 54 |
<div className="flex items-center gap-2 px-2 py-3 text-sm text-stone-500">
|
| 55 |
<LoaderCircle className="size-4 animate-spin" />
|
|
@@ -62,21 +67,22 @@ export function ImageSidebar({
|
|
| 62 |
const active = conversation.id === selectedConversationId;
|
| 63 |
const stats = getImageConversationStats(conversation);
|
| 64 |
return (
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
| 69 |
active
|
| 70 |
-
? "border-stone-900 bg-black/[0.
|
| 71 |
: "border-transparent text-stone-700 hover:border-stone-300 hover:bg-white/40",
|
| 72 |
)}
|
| 73 |
>
|
| 74 |
<button
|
| 75 |
type="button"
|
| 76 |
onClick={() => onSelectConversation(conversation.id)}
|
| 77 |
-
className="block w-full pr-
|
| 78 |
>
|
| 79 |
-
<div className="truncate text-
|
| 80 |
<span className="truncate">{conversation.title}</span>
|
| 81 |
</div>
|
| 82 |
<div className={cn("mt-1 text-xs", active ? "text-stone-500" : "text-stone-400")}>
|
|
@@ -93,14 +99,16 @@ export function ImageSidebar({
|
|
| 93 |
</div>
|
| 94 |
) : null}
|
| 95 |
</button>
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
</div>
|
| 105 |
);
|
| 106 |
})
|
|
|
|
| 49 |
</div>
|
| 50 |
)}
|
| 51 |
|
| 52 |
+
<div
|
| 53 |
+
className={cn(
|
| 54 |
+
"min-h-0 flex-1 overflow-y-auto [scrollbar-color:rgba(120,113,108,.45)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-stone-400/45 [&::-webkit-scrollbar-track]:bg-transparent",
|
| 55 |
+
hideActionButtons ? "space-y-1 pr-0" : "space-y-2 pr-1",
|
| 56 |
+
)}
|
| 57 |
+
>
|
| 58 |
{isLoadingHistory ? (
|
| 59 |
<div className="flex items-center gap-2 px-2 py-3 text-sm text-stone-500">
|
| 60 |
<LoaderCircle className="size-4 animate-spin" />
|
|
|
|
| 67 |
const active = conversation.id === selectedConversationId;
|
| 68 |
const stats = getImageConversationStats(conversation);
|
| 69 |
return (
|
| 70 |
+
<div
|
| 71 |
+
key={conversation.id}
|
| 72 |
+
className={cn(
|
| 73 |
+
"group relative w-full border-l-2 text-left transition",
|
| 74 |
+
hideActionButtons ? "px-4 py-3.5" : "px-3 py-2 sm:py-3",
|
| 75 |
active
|
| 76 |
+
? "border-stone-900 bg-black/[0.035] text-stone-950"
|
| 77 |
: "border-transparent text-stone-700 hover:border-stone-300 hover:bg-white/40",
|
| 78 |
)}
|
| 79 |
>
|
| 80 |
<button
|
| 81 |
type="button"
|
| 82 |
onClick={() => onSelectConversation(conversation.id)}
|
| 83 |
+
className={cn("block w-full text-left", hideActionButtons ? "pr-0" : "pr-8")}
|
| 84 |
>
|
| 85 |
+
<div className={cn("truncate font-semibold", hideActionButtons ? "text-base" : "text-sm")}>
|
| 86 |
<span className="truncate">{conversation.title}</span>
|
| 87 |
</div>
|
| 88 |
<div className={cn("mt-1 text-xs", active ? "text-stone-500" : "text-stone-400")}>
|
|
|
|
| 99 |
</div>
|
| 100 |
) : null}
|
| 101 |
</button>
|
| 102 |
+
{!hideActionButtons ? (
|
| 103 |
+
<button
|
| 104 |
+
type="button"
|
| 105 |
+
onClick={() => void onDeleteConversation(conversation.id)}
|
| 106 |
+
className="absolute top-3 right-2 inline-flex size-7 items-center justify-center rounded-md text-stone-400 opacity-0 transition hover:bg-stone-100 hover:text-rose-500 group-hover:opacity-100"
|
| 107 |
+
aria-label="删除会话"
|
| 108 |
+
>
|
| 109 |
+
<Trash2 className="size-4" />
|
| 110 |
+
</button>
|
| 111 |
+
) : null}
|
| 112 |
</div>
|
| 113 |
);
|
| 114 |
})
|
web/src/app/image/page.tsx
CHANGED
|
@@ -183,7 +183,6 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 183 |
|
| 184 |
const [imagePrompt, setImagePrompt] = useState("");
|
| 185 |
const [imageCount, setImageCount] = useState("1");
|
| 186 |
-
const [imageMode, setImageMode] = useState<ImageConversationMode>("generate");
|
| 187 |
const [imageSize, setImageSize] = useState("");
|
| 188 |
const [isHistoryOpen, setIsHistoryOpen] = useState(false);
|
| 189 |
const [referenceImageFiles, setReferenceImageFiles] = useState<File[]>([]);
|
|
@@ -374,7 +373,6 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 374 |
}, []);
|
| 375 |
|
| 376 |
const resetComposer = useCallback(() => {
|
| 377 |
-
setImageMode("generate");
|
| 378 |
clearComposerInputs();
|
| 379 |
}, [clearComposerInputs]);
|
| 380 |
|
|
@@ -457,7 +455,6 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 457 |
|
| 458 |
setReferenceImageFiles((prev) => [...prev, ...files]);
|
| 459 |
setReferenceImages((prev) => [...prev, ...previews]);
|
| 460 |
-
setImageMode("edit");
|
| 461 |
if (fileInputRef.current) {
|
| 462 |
fileInputRef.current.value = "";
|
| 463 |
}
|
|
@@ -500,7 +497,6 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 500 |
}
|
| 501 |
|
| 502 |
setSelectedConversationId(conversationId);
|
| 503 |
-
setImageMode("edit");
|
| 504 |
setReferenceImages((prev) => [...prev, nextReferenceImage]);
|
| 505 |
setReferenceImageFiles((prev) => [
|
| 506 |
...prev,
|
|
@@ -740,10 +736,7 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 740 |
return;
|
| 741 |
}
|
| 742 |
|
| 743 |
-
|
| 744 |
-
toast.error("请先上传参考图");
|
| 745 |
-
return;
|
| 746 |
-
}
|
| 747 |
|
| 748 |
const targetConversation = selectedConversationId
|
| 749 |
? conversationsRef.current.find((conversation) => conversation.id === selectedConversationId) ?? null
|
|
@@ -755,8 +748,8 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 755 |
id: turnId,
|
| 756 |
prompt,
|
| 757 |
model: "gpt-image-2",
|
| 758 |
-
mode:
|
| 759 |
-
referenceImages:
|
| 760 |
count: parsedCount,
|
| 761 |
size: imageSize,
|
| 762 |
images: Array.from({ length: parsedCount }, (_, index) => ({
|
|
@@ -799,7 +792,7 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 799 |
|
| 800 |
return (
|
| 801 |
<>
|
| 802 |
-
<section className="mx-auto grid h-[calc(
|
| 803 |
<div className="hidden h-full min-h-0 border-r border-stone-200/70 pr-3 lg:block">
|
| 804 |
<ImageSidebar
|
| 805 |
conversations={conversations}
|
|
@@ -814,14 +807,14 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 814 |
</div>
|
| 815 |
|
| 816 |
<Dialog open={isHistoryOpen} onOpenChange={setIsHistoryOpen}>
|
| 817 |
-
<DialogContent className="flex h-[
|
| 818 |
-
<DialogHeader className="px-6 pt-
|
| 819 |
-
<DialogTitle className="flex items-center gap-2 text-
|
| 820 |
<History className="size-5" />
|
| 821 |
历史记录
|
| 822 |
</DialogTitle>
|
| 823 |
</DialogHeader>
|
| 824 |
-
<div className="min-h-0 flex-1 overflow-y-auto px-
|
| 825 |
<ImageSidebar
|
| 826 |
conversations={conversations}
|
| 827 |
isLoadingHistory={isLoadingHistory}
|
|
@@ -843,11 +836,11 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 843 |
</DialogContent>
|
| 844 |
</Dialog>
|
| 845 |
|
| 846 |
-
<div className="flex min-h-0 flex-col gap-
|
| 847 |
-
<div className="flex items-center justify-between gap-
|
| 848 |
<Button
|
| 849 |
variant="outline"
|
| 850 |
-
className="h-10 flex-1 rounded-2xl border-stone-200 bg-white/
|
| 851 |
onClick={() => setIsHistoryOpen(true)}
|
| 852 |
>
|
| 853 |
<History className="mr-2 size-4" />
|
|
@@ -872,7 +865,7 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 872 |
|
| 873 |
<div
|
| 874 |
ref={resultsViewportRef}
|
| 875 |
-
className="hide-scrollbar min-h-0 flex-1 overflow-y-auto px-
|
| 876 |
>
|
| 877 |
<ImageResults
|
| 878 |
selectedConversation={selectedConversation}
|
|
@@ -883,7 +876,6 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 883 |
</div>
|
| 884 |
|
| 885 |
<ImageComposer
|
| 886 |
-
mode={imageMode}
|
| 887 |
prompt={imagePrompt}
|
| 888 |
imageCount={imageCount}
|
| 889 |
imageSize={imageSize}
|
|
@@ -892,7 +884,6 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
|
|
| 892 |
referenceImages={referenceImages}
|
| 893 |
textareaRef={textareaRef}
|
| 894 |
fileInputRef={fileInputRef}
|
| 895 |
-
onModeChange={setImageMode}
|
| 896 |
onPromptChange={setImagePrompt}
|
| 897 |
onImageCountChange={setImageCount}
|
| 898 |
onImageSizeChange={setImageSize}
|
|
|
|
| 183 |
|
| 184 |
const [imagePrompt, setImagePrompt] = useState("");
|
| 185 |
const [imageCount, setImageCount] = useState("1");
|
|
|
|
| 186 |
const [imageSize, setImageSize] = useState("");
|
| 187 |
const [isHistoryOpen, setIsHistoryOpen] = useState(false);
|
| 188 |
const [referenceImageFiles, setReferenceImageFiles] = useState<File[]>([]);
|
|
|
|
| 373 |
}, []);
|
| 374 |
|
| 375 |
const resetComposer = useCallback(() => {
|
|
|
|
| 376 |
clearComposerInputs();
|
| 377 |
}, [clearComposerInputs]);
|
| 378 |
|
|
|
|
| 455 |
|
| 456 |
setReferenceImageFiles((prev) => [...prev, ...files]);
|
| 457 |
setReferenceImages((prev) => [...prev, ...previews]);
|
|
|
|
| 458 |
if (fileInputRef.current) {
|
| 459 |
fileInputRef.current.value = "";
|
| 460 |
}
|
|
|
|
| 497 |
}
|
| 498 |
|
| 499 |
setSelectedConversationId(conversationId);
|
|
|
|
| 500 |
setReferenceImages((prev) => [...prev, nextReferenceImage]);
|
| 501 |
setReferenceImageFiles((prev) => [
|
| 502 |
...prev,
|
|
|
|
| 736 |
return;
|
| 737 |
}
|
| 738 |
|
| 739 |
+
const effectiveImageMode: ImageConversationMode = referenceImageFiles.length > 0 ? "edit" : "generate";
|
|
|
|
|
|
|
|
|
|
| 740 |
|
| 741 |
const targetConversation = selectedConversationId
|
| 742 |
? conversationsRef.current.find((conversation) => conversation.id === selectedConversationId) ?? null
|
|
|
|
| 748 |
id: turnId,
|
| 749 |
prompt,
|
| 750 |
model: "gpt-image-2",
|
| 751 |
+
mode: effectiveImageMode,
|
| 752 |
+
referenceImages: effectiveImageMode === "edit" ? referenceImages : [],
|
| 753 |
count: parsedCount,
|
| 754 |
size: imageSize,
|
| 755 |
images: Array.from({ length: parsedCount }, (_, index) => ({
|
|
|
|
| 792 |
|
| 793 |
return (
|
| 794 |
<>
|
| 795 |
+
<section className="mx-auto grid h-[calc(100dvh-6.25rem)] min-h-0 w-full max-w-[1380px] grid-cols-1 gap-2 px-0 pb-[calc(env(safe-area-inset-bottom)+0.5rem)] sm:h-[calc(100dvh-5rem)] sm:gap-3 sm:px-3 sm:pb-6 lg:grid-cols-[240px_minmax(0,1fr)]">
|
| 796 |
<div className="hidden h-full min-h-0 border-r border-stone-200/70 pr-3 lg:block">
|
| 797 |
<ImageSidebar
|
| 798 |
conversations={conversations}
|
|
|
|
| 807 |
</div>
|
| 808 |
|
| 809 |
<Dialog open={isHistoryOpen} onOpenChange={setIsHistoryOpen}>
|
| 810 |
+
<DialogContent className="flex h-[min(82dvh,760px)] w-[92vw] max-w-[460px] flex-col overflow-hidden rounded-[32px] border-white/80 bg-white p-0 shadow-[0_32px_110px_-38px_rgba(15,23,42,0.45)] sm:rounded-[36px]">
|
| 811 |
+
<DialogHeader className="px-6 pt-7 pb-4 sm:px-8">
|
| 812 |
+
<DialogTitle className="flex items-center gap-2 text-xl font-bold tracking-tight">
|
| 813 |
<History className="size-5" />
|
| 814 |
历史记录
|
| 815 |
</DialogTitle>
|
| 816 |
</DialogHeader>
|
| 817 |
+
<div className="min-h-0 flex-1 overflow-y-auto px-5 pb-8 sm:px-8">
|
| 818 |
<ImageSidebar
|
| 819 |
conversations={conversations}
|
| 820 |
isLoadingHistory={isLoadingHistory}
|
|
|
|
| 836 |
</DialogContent>
|
| 837 |
</Dialog>
|
| 838 |
|
| 839 |
+
<div className="flex min-h-0 flex-col gap-2 sm:gap-4">
|
| 840 |
+
<div className="flex items-center justify-between gap-2 px-1 lg:hidden">
|
| 841 |
<Button
|
| 842 |
variant="outline"
|
| 843 |
+
className="h-10 flex-1 rounded-2xl border-stone-200 bg-white/90 text-stone-700 shadow-sm"
|
| 844 |
onClick={() => setIsHistoryOpen(true)}
|
| 845 |
>
|
| 846 |
<History className="mr-2 size-4" />
|
|
|
|
| 865 |
|
| 866 |
<div
|
| 867 |
ref={resultsViewportRef}
|
| 868 |
+
className="hide-scrollbar min-h-0 flex-1 overflow-y-auto px-1 py-2 sm:px-4 sm:py-4"
|
| 869 |
>
|
| 870 |
<ImageResults
|
| 871 |
selectedConversation={selectedConversation}
|
|
|
|
| 876 |
</div>
|
| 877 |
|
| 878 |
<ImageComposer
|
|
|
|
| 879 |
prompt={imagePrompt}
|
| 880 |
imageCount={imageCount}
|
| 881 |
imageSize={imageSize}
|
|
|
|
| 884 |
referenceImages={referenceImages}
|
| 885 |
textareaRef={textareaRef}
|
| 886 |
fileInputRef={fileInputRef}
|
|
|
|
| 887 |
onPromptChange={setImagePrompt}
|
| 888 |
onImageCountChange={setImageCount}
|
| 889 |
onImageSizeChange={setImageSize}
|
web/src/components/top-nav.tsx
CHANGED
|
@@ -64,11 +64,11 @@ export function TopNav() {
|
|
| 64 |
|
| 65 |
return (
|
| 66 |
<header className="border-b border-stone-100/50">
|
| 67 |
-
<div className="flex h-12 items-center justify-between
|
| 68 |
-
<div className="flex items-center gap-2 sm:gap-3">
|
| 69 |
<Link
|
| 70 |
href="/image"
|
| 71 |
-
className="py-1 text-[
|
| 72 |
>
|
| 73 |
chatgpt2api
|
| 74 |
</Link>
|
|
@@ -82,8 +82,15 @@ export function TopNav() {
|
|
| 82 |
<Github className="size-4" />
|
| 83 |
<span className="hidden md:inline">GitHub</span>
|
| 84 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
</div>
|
| 86 |
-
<
|
| 87 |
{navItems.map((item) => {
|
| 88 |
const active = pathname === item.href;
|
| 89 |
return (
|
|
@@ -91,17 +98,19 @@ export function TopNav() {
|
|
| 91 |
key={item.href}
|
| 92 |
href={item.href}
|
| 93 |
className={cn(
|
| 94 |
-
"relative py-1 text-[13px] font-medium transition sm:text-[15px]",
|
| 95 |
-
active
|
|
|
|
|
|
|
| 96 |
)}
|
| 97 |
>
|
| 98 |
{item.label}
|
| 99 |
-
{active ? <span className="absolute inset-x-0 -bottom-[1px] h-0.5 bg-stone-950" /> : null}
|
| 100 |
</Link>
|
| 101 |
);
|
| 102 |
})}
|
| 103 |
-
</
|
| 104 |
-
<div className="
|
| 105 |
<span className="hidden rounded-md bg-stone-100 px-2 py-1 text-[10px] font-medium text-stone-500 sm:inline-block sm:text-[11px]">
|
| 106 |
{roleLabel}
|
| 107 |
</span>
|
|
|
|
| 64 |
|
| 65 |
return (
|
| 66 |
<header className="border-b border-stone-100/50">
|
| 67 |
+
<div className="flex min-h-12 flex-col gap-1 px-3 py-2 sm:h-12 sm:flex-row sm:items-center sm:justify-between sm:gap-3 sm:px-6 sm:py-0">
|
| 68 |
+
<div className="flex items-center justify-between gap-2 sm:justify-start sm:gap-3">
|
| 69 |
<Link
|
| 70 |
href="/image"
|
| 71 |
+
className="shrink-0 py-1 text-[15px] font-bold tracking-tight text-stone-950 transition hover:text-stone-700"
|
| 72 |
>
|
| 73 |
chatgpt2api
|
| 74 |
</Link>
|
|
|
|
| 82 |
<Github className="size-4" />
|
| 83 |
<span className="hidden md:inline">GitHub</span>
|
| 84 |
</a>
|
| 85 |
+
<button
|
| 86 |
+
type="button"
|
| 87 |
+
className="ml-auto shrink-0 py-1 text-xs text-stone-400 transition hover:text-stone-700 sm:hidden"
|
| 88 |
+
onClick={() => void handleLogout()}
|
| 89 |
+
>
|
| 90 |
+
退出
|
| 91 |
+
</button>
|
| 92 |
</div>
|
| 93 |
+
<nav className="hide-scrollbar -mx-1 flex min-w-0 flex-1 gap-1 overflow-x-auto px-1 sm:mx-0 sm:justify-center sm:gap-8 sm:overflow-visible sm:px-0">
|
| 94 |
{navItems.map((item) => {
|
| 95 |
const active = pathname === item.href;
|
| 96 |
return (
|
|
|
|
| 98 |
key={item.href}
|
| 99 |
href={item.href}
|
| 100 |
className={cn(
|
| 101 |
+
"relative shrink-0 whitespace-nowrap rounded-full px-2.5 py-1 text-[13px] font-medium transition sm:rounded-none sm:px-0 sm:text-[15px]",
|
| 102 |
+
active
|
| 103 |
+
? "bg-stone-950 text-white sm:bg-transparent sm:font-semibold sm:text-stone-950"
|
| 104 |
+
: "text-stone-500 hover:text-stone-900",
|
| 105 |
)}
|
| 106 |
>
|
| 107 |
{item.label}
|
| 108 |
+
{active ? <span className="absolute inset-x-0 -bottom-[1px] hidden h-0.5 bg-stone-950 sm:block" /> : null}
|
| 109 |
</Link>
|
| 110 |
);
|
| 111 |
})}
|
| 112 |
+
</nav>
|
| 113 |
+
<div className="hidden items-center justify-end gap-2 sm:flex sm:gap-3">
|
| 114 |
<span className="hidden rounded-md bg-stone-100 px-2 py-1 text-[10px] font-medium text-stone-500 sm:inline-block sm:text-[11px]">
|
| 115 |
{roleLabel}
|
| 116 |
</span>
|