Skip to content

Commit ad44711

Browse files
committed
Improved styling
1 parent 9cd82aa commit ad44711

38 files changed

+184
-80
lines changed

smoosense-gui/src/components/folder-browser/previewers/AlbumHeaderControls.tsx

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -31,66 +31,69 @@ export default function AlbumHeaderControls({
3131
}
3232

3333
return (
34-
<div className="flex items-center justify-between w-full">
35-
{/* Album title and video play/stop button - leftmost */}
36-
<div className="flex items-center gap-4">
37-
<div className="flex items-center gap-2">
38-
<Images className="h-5 w-5" />
39-
<span className="font-medium">
40-
{mediaFilesCount} items
41-
</span>
42-
</div>
43-
{hasVideos && (
44-
<Button
45-
variant="outline"
46-
size="sm"
47-
onClick={handleToggleAutoPlay}
48-
className="flex items-center gap-2"
49-
>
50-
{autoPlayAllVideos ? (
51-
<>
52-
<Square className="h-4 w-4" />
53-
Stop
54-
</>
55-
) : (
56-
<>
57-
<Play className="h-4 w-4" />
58-
Play
59-
</>
60-
)}
61-
</Button>
62-
)}
63-
</div>
64-
65-
{/* Gallery controls - middle */}
66-
<GalleryMoreControlsContent className="flex items-center gap-4 space-y-0 max-w-none min-w-140" />
67-
68-
{/* Pagination controls - rightmost */}
69-
<div className="flex items-center gap-2">
70-
{totalPages > 1 && (
71-
<>
72-
<Button
73-
variant="outline"
74-
size="sm"
75-
onClick={onPrevPage}
76-
disabled={currentPage === 0}
77-
>
78-
<ChevronLeft className="h-4 w-4" />
79-
</Button>
80-
<span className="text-sm text-muted-foreground px-2">
81-
{currentPage + 1} of {totalPages}
34+
<div className="flex flex-col gap-3 w-full">
35+
{/* First line: Item count and pagination */}
36+
<div className="flex items-center justify-between w-full">
37+
{/* Album title and video play/stop button - leftmost */}
38+
<div className="flex items-center gap-4">
39+
<div className="flex items-center gap-2">
40+
<Images className="h-5 w-5" />
41+
<span className="font-medium">
42+
{mediaFilesCount} items
8243
</span>
44+
</div>
45+
{hasVideos && (
8346
<Button
8447
variant="outline"
8548
size="sm"
86-
onClick={onNextPage}
87-
disabled={currentPage === totalPages - 1}
49+
onClick={handleToggleAutoPlay}
50+
className="flex items-center gap-2"
8851
>
89-
<ChevronRight className="h-4 w-4" />
52+
{autoPlayAllVideos ? (
53+
<>
54+
<Square className="h-4 w-4" />
55+
Stop
56+
</>
57+
) : (
58+
<>
59+
<Play className="h-4 w-4" />
60+
Play
61+
</>
62+
)}
9063
</Button>
91-
</>
92-
)}
64+
)}
65+
</div>
66+
67+
{/* Pagination controls - rightmost */}
68+
<div className="flex items-center gap-2">
69+
{totalPages > 1 && (
70+
<>
71+
<Button
72+
variant="outline"
73+
size="sm"
74+
onClick={onPrevPage}
75+
disabled={currentPage === 0}
76+
>
77+
<ChevronLeft className="h-4 w-4" />
78+
</Button>
79+
<span className="text-sm text-muted-foreground px-2">
80+
{currentPage + 1} of {totalPages}
81+
</span>
82+
<Button
83+
variant="outline"
84+
size="sm"
85+
onClick={onNextPage}
86+
disabled={currentPage === totalPages - 1}
87+
>
88+
<ChevronRight className="h-4 w-4" />
89+
</Button>
90+
</>
91+
)}
92+
</div>
9393
</div>
94+
95+
{/* Second line: Gallery controls */}
96+
<GalleryMoreControlsContent className="flex items-center gap-4 space-y-0 max-w-none min-w-140" />
9497
</div>
9598
)
9699
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env python
2+
"""
3+
Script to take screenshots of file/folder previews in FolderBrowser.
4+
5+
This captures previews for various file types including audio, images, videos, and data files.
6+
"""
7+
8+
import sys
9+
import time
10+
import unittest
11+
from pathlib import Path
12+
13+
# Add the intests directory to sys.path for imports
14+
sys.path.insert(0, str(Path(__file__).parent))
15+
16+
from base_integration_test import BaseIntegrationTest
17+
from utils import LocatorUtils
18+
19+
from smoosense.my_logging import getLogger
20+
21+
logger = getLogger(__name__)
22+
23+
24+
class PreviewScreenshotCapture(BaseIntegrationTest):
25+
"""Capture screenshots of file/folder previews."""
26+
27+
@classmethod
28+
def setUpClass(cls) -> None:
29+
"""Set up server, browser and preview-specific configuration."""
30+
super().setUpClass()
31+
32+
# Configure URL with S3 demo folder
33+
cls.root_folder = "s3://smoosense-demo/PreviewFiles"
34+
cls.folder_browser_url = f"{cls.server.base_url}/FolderBrowser?rootFolder={cls.root_folder}"
35+
logger.info(f"Preview URL configured: {cls.folder_browser_url}")
36+
37+
def test_capture_screenshots(self) -> None:
38+
"""Take screenshots of various file/folder previews."""
39+
40+
# Files and folders to preview
41+
items_to_preview = [
42+
"audio-files",
43+
"image-files",
44+
"ClickBench-100M.parquet",
45+
"OpenVid-1M.csv",
46+
"captions_val2017.json",
47+
"readme.md",
48+
]
49+
50+
# Take screenshots for each theme mode
51+
for mode in ["light", "dark"]:
52+
logger.info(f"Setting theme to {mode} mode")
53+
54+
# Click on each item and capture screenshot
55+
for item_name in items_to_preview:
56+
logger.info(f"Capturing preview for {item_name} in {mode} mode")
57+
58+
try:
59+
# Navigate to the FolderBrowser with fresh page load
60+
response = self.page.goto(self.folder_browser_url)
61+
if response.status != 200:
62+
logger.error(f"Failed to load FolderBrowser: HTTP {response.status}")
63+
continue
64+
65+
# Wait for the page to load completely
66+
self.page.wait_for_load_state("networkidle")
67+
time.sleep(2) # Additional wait for tree to render
68+
69+
# Set theme mode
70+
LocatorUtils.set_theme_mode(self.page, mode)
71+
time.sleep(1)
72+
73+
# Find and click the item in tree view
74+
item_locator = self.page.locator(f'span[title="{item_name}"]')
75+
76+
# Ensure item is visible and scrolled into view
77+
item_locator.scroll_into_view_if_needed()
78+
time.sleep(0.5)
79+
80+
item_locator.click()
81+
82+
# Wait for preview to load
83+
self.page.wait_for_load_state("networkidle")
84+
time.sleep(3)
85+
86+
# Take screenshot
87+
# Sanitize filename (replace special characters)
88+
safe_name = item_name.replace(".", "_").replace("/", "_")
89+
screenshot_name = f"preview_{safe_name}_{mode}.png"
90+
self.take_screenshot(screenshot_name)
91+
logger.info(f"Screenshot saved: {screenshot_name}")
92+
93+
except Exception as e:
94+
logger.error(f"Failed to capture {item_name}: {e}")
95+
continue
96+
97+
logger.info("Screenshot capture completed successfully for previews")
98+
99+
100+
if __name__ == "__main__":
101+
unittest.main()
190 KB
Loading
189 KB
Loading
334 KB
Loading
331 KB
Loading
1.48 MB
Loading
1.47 MB
Loading
144 KB
Loading
138 KB
Loading

0 commit comments

Comments
 (0)