mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-18 18:23:43 +08:00
Fix tag management view entering search flow
This commit is contained in:
@@ -58,6 +58,7 @@ export function PopularFeatures({ onSearch }: PopularFeaturesProps) {
|
||||
const [isRecommendSelected, setIsRecommendSelected] = useState(false);
|
||||
|
||||
const effectiveRecommendSelected = hasHistory && isRecommendSelected;
|
||||
const isTagManagementMode = showTagManager;
|
||||
|
||||
const {
|
||||
movies,
|
||||
@@ -92,10 +93,10 @@ export function PopularFeatures({ onSearch }: PopularFeaturesProps) {
|
||||
|
||||
return (
|
||||
<div className="animate-fade-in">
|
||||
<CategoryQuickSearch onSearch={onSearch} />
|
||||
{!isTagManagementMode && <CategoryQuickSearch onSearch={onSearch} />}
|
||||
|
||||
{/* Content Type Toggle (Capsule Liquid Glass - Fixed & Centered) */}
|
||||
{!effectiveRecommendSelected && (
|
||||
{!isTagManagementMode && !effectiveRecommendSelected && (
|
||||
<div className="mb-10 flex justify-center">
|
||||
<div className="relative w-80 p-1 bg-[var(--glass-bg)] border border-[var(--glass-border)] rounded-full grid grid-cols-2 backdrop-blur-2xl shadow-lg ring-1 ring-white/10 overflow-hidden">
|
||||
{/* Sliding Indicator */}
|
||||
@@ -146,24 +147,26 @@ export function PopularFeatures({ onSearch }: PopularFeaturesProps) {
|
||||
} : undefined}
|
||||
/>
|
||||
|
||||
{effectiveRecommendSelected ? (
|
||||
<MovieGrid
|
||||
movies={recommendMovies}
|
||||
loading={recommendLoading}
|
||||
hasMore={recommendHasMore}
|
||||
onMovieClick={handleMovieClick}
|
||||
prefetchRef={recommendPrefetchRef}
|
||||
loadMoreRef={recommendLoadMoreRef}
|
||||
/>
|
||||
) : (
|
||||
<MovieGrid
|
||||
movies={movies}
|
||||
loading={loading}
|
||||
hasMore={hasMore}
|
||||
onMovieClick={handleMovieClick}
|
||||
prefetchRef={prefetchRef}
|
||||
loadMoreRef={loadMoreRef}
|
||||
/>
|
||||
{!isTagManagementMode && (
|
||||
effectiveRecommendSelected ? (
|
||||
<MovieGrid
|
||||
movies={recommendMovies}
|
||||
loading={recommendLoading}
|
||||
hasMore={recommendHasMore}
|
||||
onMovieClick={handleMovieClick}
|
||||
prefetchRef={recommendPrefetchRef}
|
||||
loadMoreRef={recommendLoadMoreRef}
|
||||
/>
|
||||
) : (
|
||||
<MovieGrid
|
||||
movies={movies}
|
||||
loading={loading}
|
||||
hasMore={hasMore}
|
||||
onMovieClick={handleMovieClick}
|
||||
prefetchRef={prefetchRef}
|
||||
loadMoreRef={loadMoreRef}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -51,6 +51,7 @@ export function SortableTag({
|
||||
>
|
||||
<div className={`${showTagManager && !isDragging ? 'animate-jiggle' : ''}`}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onTagSelect(tag.id)}
|
||||
className={`
|
||||
px-6 py-2.5 text-sm font-semibold transition-all whitespace-nowrap rounded-[var(--radius-full)] cursor-pointer select-none
|
||||
@@ -64,6 +65,7 @@ export function SortableTag({
|
||||
</button>
|
||||
{showTagManager && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onTagDelete(tag.id);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import { Icons } from '@/components/ui/Icon';
|
||||
|
||||
interface TagInputProps {
|
||||
newTagInput: string;
|
||||
onNewTagInputChange: (value: string) => void;
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
SortableContext,
|
||||
sortableKeyboardCoordinates,
|
||||
horizontalListSortingStrategy,
|
||||
rectSortingStrategy,
|
||||
} from '@dnd-kit/sortable';
|
||||
import { SortableTag, Tag } from './SortableTag';
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
@@ -115,12 +116,17 @@ export function TagList({
|
||||
>
|
||||
<div
|
||||
ref={scrollContainerRef}
|
||||
className="mb-8 flex items-center gap-3 overflow-x-auto pb-3 pt-2 px-1 scrollbar-hide"
|
||||
className={`mb-8 flex items-center gap-3 pb-3 pt-2 px-1 scrollbar-hide ${
|
||||
showTagManager
|
||||
? 'flex-wrap overflow-visible'
|
||||
: 'overflow-x-auto'
|
||||
}`}
|
||||
>
|
||||
{/* Recommendation Tag — non-draggable, rendered before sortable tags */}
|
||||
{recommendTag && (
|
||||
<div className="relative flex-shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
onClick={recommendTag.onSelect}
|
||||
className={`
|
||||
px-6 py-2.5 text-sm font-semibold transition-all whitespace-nowrap rounded-[var(--radius-full)] cursor-pointer select-none flex items-center gap-1.5
|
||||
@@ -137,7 +143,7 @@ export function TagList({
|
||||
)}
|
||||
<SortableContext
|
||||
items={tags.map((t) => t.id)}
|
||||
strategy={horizontalListSortingStrategy}
|
||||
strategy={showTagManager ? rectSortingStrategy : horizontalListSortingStrategy}
|
||||
>
|
||||
{tags.map((tag) => (
|
||||
<SortableTag
|
||||
|
||||
Reference in New Issue
Block a user