mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
feat: improve mobile responsiveness across all UIs
- Main Frontend: - Stack Artist/Title inputs vertically on mobile (< 640px) - Improve tab button touch targets with min-height 44px - Make header responsive with icon-only buttons on small screens - Hide button text labels on mobile, show icons only - Lyrics Review UI (Material UI): - Make handler panel width responsive (100% on mobile) - Fix button toolbar to wrap on mobile - Adjust heights for mobile viewports - Instrumental Selection UI (Static HTML): - Add comprehensive mobile media queries - Stack bottom section vertically on mobile - Make selection panel full-width on mobile - Increase touch targets to 44px minimum - Allow scrolling on mobile viewports - Testing: - Add mobile device projects to Playwright config (Pixel 7, iPhone 14) - Create comprehensive mobile responsiveness test suite - Test no horizontal overflow, touch targets, form usability - Documentation: - Add MOBILE-UX-BEST-PRACTICES.md with patterns and guidelines 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79be51c95d
commit
e0e35f5335
9 files changed
+670
-39
No files matched your search
@@ -0,0 +1,318 @@
|
||||
# Mobile UX Best Practices
|
||||
|
||||
This document outlines the mobile-first UX principles and implementation patterns used in this project to ensure a great experience across all screen sizes.
|
||||
|
||||
## Core Principles
|
||||
|
||||
### 1. Mobile-First Responsive Design
|
||||
|
||||
Design for the smallest screen first, then progressively enhance for larger screens.
|
||||
|
||||
```css
|
||||
/* Base styles for mobile */
|
||||
.element {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
/* Enhance for larger screens */
|
||||
@media (min-width: 640px) {
|
||||
.element {
|
||||
width: 280px;
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. No Horizontal Overflow
|
||||
|
||||
The most critical mobile UX issue is horizontal scrolling. Always ensure content fits within the viewport width.
|
||||
|
||||
**Testing for overflow:**
|
||||
```typescript
|
||||
async function hasNoHorizontalOverflow(page: Page): Promise<boolean> {
|
||||
return await page.evaluate(() => {
|
||||
const docWidth = document.documentElement.scrollWidth;
|
||||
const viewportWidth = window.innerWidth;
|
||||
return docWidth <= viewportWidth + 2; // Small tolerance for rounding
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
**Common causes of horizontal overflow:**
|
||||
- Fixed widths (e.g., `width: 340px`)
|
||||
- Horizontal flex layouts without wrapping
|
||||
- Images without `max-width: 100%`
|
||||
- Tables without horizontal scroll containers
|
||||
|
||||
### 3. Touch Target Sizing
|
||||
|
||||
Interactive elements must be easily tappable. Follow these minimum sizes:
|
||||
|
||||
| Platform | Minimum Size | Recommended |
|
||||
|----------|--------------|-------------|
|
||||
| Apple iOS | 44x44px | 48x48px |
|
||||
| Material Design | 48x48px | 48x48px |
|
||||
| Web (general) | 32x32px | 44x44px |
|
||||
|
||||
**Implementation:**
|
||||
```tsx
|
||||
<Button className="min-h-[44px] px-3">
|
||||
<Icon className="w-4 h-4" />
|
||||
<span className="hidden sm:inline">Label</span>
|
||||
</Button>
|
||||
```
|
||||
|
||||
### 4. Progressive Disclosure
|
||||
|
||||
Show less content on mobile, with clear paths to access more:
|
||||
|
||||
- **Icon-only buttons on mobile, labels on desktop:**
|
||||
```tsx
|
||||
<Icon className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">Action Label</span>
|
||||
```
|
||||
|
||||
- **Collapsed navigation on mobile**
|
||||
- **Truncated text with expansion options**
|
||||
|
||||
## Layout Patterns
|
||||
|
||||
### Responsive Grid
|
||||
|
||||
Use responsive grid columns that stack on mobile:
|
||||
|
||||
```tsx
|
||||
// Bad - always 2 columns
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
|
||||
// Good - stack on mobile, 2 columns on larger screens
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
```
|
||||
|
||||
### Flexible Containers
|
||||
|
||||
Avoid fixed widths. Use percentage-based or responsive widths:
|
||||
|
||||
```css
|
||||
/* Bad */
|
||||
.sidebar {
|
||||
width: 340px;
|
||||
}
|
||||
|
||||
/* Good */
|
||||
.sidebar {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.sidebar {
|
||||
width: 340px;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Flex Wrap for Toolbars
|
||||
|
||||
Allow toolbar items to wrap on smaller screens:
|
||||
|
||||
```tsx
|
||||
<div className="flex flex-wrap gap-2 items-center">
|
||||
{/* Items will wrap naturally */}
|
||||
</div>
|
||||
```
|
||||
|
||||
## Typography
|
||||
|
||||
### Readable Font Sizes
|
||||
|
||||
Minimum font sizes for readability without zooming:
|
||||
|
||||
| Element | Minimum Size | Recommended |
|
||||
|---------|--------------|-------------|
|
||||
| Body text | 14px | 16px |
|
||||
| Labels | 12px | 14px |
|
||||
| Small text/badges | 11px | 12px |
|
||||
|
||||
### Responsive Headings
|
||||
|
||||
```tsx
|
||||
<h1 className="text-base sm:text-xl font-bold truncate">
|
||||
Title Text
|
||||
</h1>
|
||||
```
|
||||
|
||||
## Form Design
|
||||
|
||||
### Input Fields on Mobile
|
||||
|
||||
- Stack form fields vertically on mobile
|
||||
- Use full-width inputs for easier tapping
|
||||
- Ensure proper input type for mobile keyboard optimization
|
||||
|
||||
```tsx
|
||||
<input
|
||||
type="email" // Shows email keyboard
|
||||
inputMode="numeric" // Shows number pad
|
||||
className="w-full min-h-[44px]"
|
||||
/>
|
||||
```
|
||||
|
||||
### Labels and Placeholders
|
||||
|
||||
- Labels should be visible (not just placeholders)
|
||||
- Adequate spacing between label and input
|
||||
- Clear validation feedback
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Automated Testing with Playwright
|
||||
|
||||
Test across multiple viewport sizes representing real devices:
|
||||
|
||||
```typescript
|
||||
const MOBILE_VIEWPORTS = {
|
||||
'iPhone SE': { width: 375, height: 667 },
|
||||
'iPhone 14': { width: 390, height: 844 },
|
||||
'Pixel 7': { width: 412, height: 915 },
|
||||
'iPad Mini': { width: 768, height: 1024 },
|
||||
};
|
||||
|
||||
for (const [name, viewport] of Object.entries(MOBILE_VIEWPORTS)) {
|
||||
test(`page works on ${name}`, async ({ page }) => {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.goto('/');
|
||||
|
||||
// Test for horizontal overflow
|
||||
const hasOverflow = await page.evaluate(() =>
|
||||
document.documentElement.scrollWidth > window.innerWidth + 2
|
||||
);
|
||||
expect(hasOverflow).toBe(false);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Visual Regression Testing
|
||||
|
||||
Capture screenshots at different viewports to catch visual regressions:
|
||||
|
||||
```typescript
|
||||
await expect(page).toHaveScreenshot(`homepage-${deviceName}.png`, {
|
||||
fullPage: true,
|
||||
maxDiffPixelRatio: 0.1,
|
||||
});
|
||||
```
|
||||
|
||||
### Touch Target Validation
|
||||
|
||||
```typescript
|
||||
const buttons = page.locator('button, a, [role="button"]');
|
||||
for (const button of await buttons.all()) {
|
||||
const box = await button.boundingBox();
|
||||
if (box) {
|
||||
expect(box.width).toBeGreaterThanOrEqual(32);
|
||||
expect(box.height).toBeGreaterThanOrEqual(32);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Framework-Specific Guidelines
|
||||
|
||||
### Tailwind CSS (Next.js Frontend)
|
||||
|
||||
Use responsive prefixes consistently:
|
||||
|
||||
```
|
||||
sm: 640px - Small tablets and up
|
||||
md: 768px - Tablets and up
|
||||
lg: 1024px - Laptops and up
|
||||
xl: 1280px - Desktops and up
|
||||
```
|
||||
|
||||
**Common patterns:**
|
||||
```tsx
|
||||
// Stack on mobile, side-by-side on larger
|
||||
className="flex flex-col sm:flex-row"
|
||||
|
||||
// Hide on mobile, show on larger
|
||||
className="hidden sm:block"
|
||||
|
||||
// Reduce padding on mobile
|
||||
className="p-3 sm:p-4"
|
||||
|
||||
// Smaller font on mobile
|
||||
className="text-xs sm:text-sm"
|
||||
```
|
||||
|
||||
### Material UI (Lyrics Review UI)
|
||||
|
||||
Use the `useMediaQuery` hook:
|
||||
|
||||
```tsx
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
||||
|
||||
return (
|
||||
<Box sx={{
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
width: isMobile ? '100%' : '280px',
|
||||
}}>
|
||||
```
|
||||
|
||||
### Vanilla CSS (Instrumental Review)
|
||||
|
||||
Use CSS media queries:
|
||||
|
||||
```css
|
||||
.element {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.element {
|
||||
width: 340px;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Checklist for New Features
|
||||
|
||||
Before merging any UI changes, verify:
|
||||
|
||||
- [ ] No horizontal overflow on any mobile viewport (320px - 480px)
|
||||
- [ ] All interactive elements are at least 44x44px
|
||||
- [ ] Text is readable without zooming (minimum 11px)
|
||||
- [ ] Form inputs stack vertically on mobile
|
||||
- [ ] Navigation is accessible on mobile
|
||||
- [ ] Images scale properly with `max-width: 100%`
|
||||
- [ ] Modals/dialogs fit within mobile viewport
|
||||
- [ ] Buttons show icons-only on very small screens
|
||||
- [ ] Playwright mobile tests pass
|
||||
|
||||
## Common Fixes
|
||||
|
||||
### Fix: Horizontal Overflow
|
||||
|
||||
1. **Check for fixed widths** - Replace with responsive values
|
||||
2. **Add flex-wrap** - Allow content to wrap
|
||||
3. **Add overflow-x: hidden** - On containers (use sparingly)
|
||||
4. **Check images** - Add `max-width: 100%`
|
||||
|
||||
### Fix: Touch Target Too Small
|
||||
|
||||
1. **Add minimum height** - `min-h-[44px]`
|
||||
2. **Add padding** - `p-3` or `px-4 py-3`
|
||||
3. **Use icon-only on mobile** - Hide text labels
|
||||
|
||||
### Fix: Text Too Small
|
||||
|
||||
1. **Use responsive font sizes** - `text-xs sm:text-sm`
|
||||
2. **Set minimum body font size** - At least 14px
|
||||
3. **Increase line height** - For better readability
|
||||
|
||||
## Resources
|
||||
|
||||
- [Apple Human Interface Guidelines - Touch Targets](https://developer.apple.com/design/human-interface-guidelines/accessibility)
|
||||
- [Material Design - Touch Targets](https://m3.material.io/foundations/accessible-design/accessibility-basics)
|
||||
- [Tailwind CSS Responsive Design](https://tailwindcss.com/docs/responsive-design)
|
||||
- [Playwright Testing](https://playwright.dev/docs/test-mobile)
|
||||
+14
-12
@@ -75,14 +75,14 @@ export default function HomePage() {
|
||||
|
||||
{/* Header */}
|
||||
<header className="border-b backdrop-blur-sm sticky top-0 z-10" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--card)' }}>
|
||||
<div className="px-4 py-3 flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-10" />
|
||||
<div>
|
||||
<h1 className="text-xl font-bold" style={{ color: 'var(--text)' }}>Karaoke Generator</h1>
|
||||
<div className="px-3 sm:px-4 py-2 sm:py-3 flex items-center justify-between gap-2">
|
||||
<div className="flex items-center gap-2 sm:gap-3 min-w-0">
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-8 sm:h-10 shrink-0" />
|
||||
<div className="min-w-0">
|
||||
<h1 className="text-base sm:text-xl font-bold truncate" style={{ color: 'var(--text)' }}>Karaoke Generator</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="flex items-center gap-1 sm:gap-2 shrink-0">
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
@@ -90,15 +90,15 @@ export default function HomePage() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={toggleAutoMode}
|
||||
className={autoModeEnabled ? "text-amber-400 hover:text-amber-300 bg-amber-500/10" : ""}
|
||||
className={`min-h-[40px] px-2 sm:px-3 ${autoModeEnabled ? "text-amber-400 hover:text-amber-300 bg-amber-500/10" : ""}`}
|
||||
style={!autoModeEnabled ? { color: 'var(--text-muted)' } : undefined}
|
||||
>
|
||||
{autoModeEnabled ? (
|
||||
<Zap className="w-4 h-4 mr-2" />
|
||||
<Zap className="w-4 h-4 sm:mr-2" />
|
||||
) : (
|
||||
<ZapOff className="w-4 h-4 mr-2" />
|
||||
<ZapOff className="w-4 h-4 sm:mr-2" />
|
||||
)}
|
||||
Auto
|
||||
<span className="hidden sm:inline">Auto</span>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom" className="max-w-xs">
|
||||
@@ -118,10 +118,11 @@ export default function HomePage() {
|
||||
size="sm"
|
||||
onClick={loadJobs}
|
||||
disabled={isLoadingJobs || !isAuthenticated}
|
||||
className="min-h-[40px] px-2 sm:px-3"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<RefreshCw className={`w-4 h-4 mr-2 ${isLoadingJobs ? 'animate-spin' : ''}`} />
|
||||
Refresh
|
||||
<RefreshCw className={`w-4 h-4 sm:mr-2 ${isLoadingJobs ? 'animate-spin' : ''}`} />
|
||||
<span className="hidden sm:inline">Refresh</span>
|
||||
</Button>
|
||||
<AuthStatus />
|
||||
{mounted && (
|
||||
@@ -132,6 +133,7 @@ export default function HomePage() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={toggleTheme}
|
||||
className="min-h-[40px] px-2 sm:px-3"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
{isDarkMode ? (
|
||||
|
||||
@@ -38,10 +38,10 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={handleLogout}
|
||||
className="text-slate-400 hover:text-white"
|
||||
className="text-slate-400 hover:text-white min-h-[40px] px-2 sm:px-3"
|
||||
>
|
||||
<LogOut className="w-4 h-4 mr-2" />
|
||||
Logout
|
||||
<LogOut className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">Logout</span>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
@@ -52,10 +52,10 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="text-amber-400 hover:text-amber-300"
|
||||
className="text-amber-400 hover:text-amber-300 min-h-[40px] px-2 sm:px-3"
|
||||
>
|
||||
<KeyRound className="w-4 h-4 mr-2" />
|
||||
Login
|
||||
<KeyRound className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">Login</span>
|
||||
</Button>
|
||||
<AuthDialog
|
||||
open={showAuthDialog}
|
||||
|
||||
@@ -147,18 +147,18 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
|
||||
return (
|
||||
<Tabs value={activeTab} onValueChange={setActiveTab}>
|
||||
<TabsList className="grid w-full grid-cols-3 bg-slate-800">
|
||||
<TabsTrigger value="upload" className="gap-2 data-[state=active]:bg-slate-700">
|
||||
<Upload className="w-4 h-4" />
|
||||
Upload
|
||||
<TabsList className="grid w-full grid-cols-3 bg-slate-800 h-auto">
|
||||
<TabsTrigger value="upload" className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm data-[state=active]:bg-slate-700">
|
||||
<Upload className="w-4 h-4 shrink-0" />
|
||||
<span className="truncate">Upload</span>
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="url" className="gap-2 data-[state=active]:bg-slate-700">
|
||||
<Youtube className="w-4 h-4" />
|
||||
URL
|
||||
<TabsTrigger value="url" className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm data-[state=active]:bg-slate-700">
|
||||
<Youtube className="w-4 h-4 shrink-0" />
|
||||
<span className="truncate">URL</span>
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="search" className="gap-2 data-[state=active]:bg-slate-700">
|
||||
<Music className="w-4 h-4" />
|
||||
Search
|
||||
<TabsTrigger value="search" className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm data-[state=active]:bg-slate-700">
|
||||
<Music className="w-4 h-4 shrink-0" />
|
||||
<span className="truncate">Search</span>
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
@@ -193,7 +193,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="upload-artist" className="text-slate-200">Artist</Label>
|
||||
<Input
|
||||
@@ -271,7 +271,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="youtube-artist" className="text-slate-200">Artist (optional)</Label>
|
||||
<Input
|
||||
@@ -333,7 +333,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
|
||||
<TabsContent value="search" className="mt-4">
|
||||
<form onSubmit={handleSearchSubmit} className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="search-artist" className="text-slate-200">Artist</Label>
|
||||
<Input
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
import { test, expect, Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Mobile Responsiveness E2E Tests
|
||||
*
|
||||
* Tests the entire user journey on mobile devices to ensure:
|
||||
* 1. All content is visible and accessible
|
||||
* 2. No horizontal scrolling occurs
|
||||
* 3. Touch targets are appropriately sized
|
||||
* 4. Text is readable without zooming
|
||||
*/
|
||||
|
||||
// Common mobile viewport sizes
|
||||
const MOBILE_VIEWPORTS = {
|
||||
'iPhone SE': { width: 375, height: 667 },
|
||||
'iPhone 14': { width: 390, height: 844 },
|
||||
'Pixel 7': { width: 412, height: 915 },
|
||||
};
|
||||
|
||||
// Helper to set auth token
|
||||
async function setAuthToken(page: Page) {
|
||||
const token = process.env.KARAOKE_ACCESS_TOKEN;
|
||||
if (token) {
|
||||
await page.evaluate((t) => {
|
||||
localStorage.setItem('karaoke_access_token', t);
|
||||
}, token);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper to check no horizontal overflow
|
||||
async function hasNoHorizontalOverflow(page: Page): Promise<boolean> {
|
||||
return await page.evaluate(() => {
|
||||
const docWidth = document.documentElement.scrollWidth;
|
||||
const viewportWidth = window.innerWidth;
|
||||
return docWidth <= viewportWidth + 2;
|
||||
});
|
||||
}
|
||||
|
||||
test.describe('Mobile Responsiveness', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await setAuthToken(page);
|
||||
});
|
||||
|
||||
for (const [deviceName, viewport] of Object.entries(MOBILE_VIEWPORTS)) {
|
||||
test.describe(`${deviceName} (${viewport.width}x${viewport.height})`, () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.goto('/');
|
||||
await page.waitForLoadState('domcontentloaded');
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
|
||||
test('page loads without horizontal scroll', async ({ page }) => {
|
||||
const noOverflow = await hasNoHorizontalOverflow(page);
|
||||
expect(noOverflow).toBe(true);
|
||||
});
|
||||
|
||||
test('header is visible and accessible', async ({ page }) => {
|
||||
// Logo should be visible
|
||||
const logo = page.locator('header img, .logo');
|
||||
await expect(logo.first()).toBeVisible();
|
||||
|
||||
// Header title should be visible (may be truncated on mobile)
|
||||
const title = page.locator('h1');
|
||||
await expect(title.first()).toBeVisible();
|
||||
});
|
||||
|
||||
test('form inputs are visible and usable', async ({ page }) => {
|
||||
// Tab buttons should be visible
|
||||
const tabs = page.locator('[role="tablist"] button, .tabs button');
|
||||
if (await tabs.count() > 0) {
|
||||
await expect(tabs.first()).toBeVisible();
|
||||
}
|
||||
|
||||
// Check that Artist/Title inputs exist (after clicking upload tab if needed)
|
||||
const uploadTab = page.locator('button:has-text("Upload")');
|
||||
if (await uploadTab.count() > 0) {
|
||||
await uploadTab.first().click();
|
||||
await page.waitForTimeout(300);
|
||||
}
|
||||
|
||||
// Artist input
|
||||
const artistInput = page.locator('input').first();
|
||||
if (await artistInput.count() > 0) {
|
||||
const box = await artistInput.boundingBox();
|
||||
if (box) {
|
||||
expect(box.width).toBeGreaterThan(100);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('buttons have adequate touch target size', async ({ page }) => {
|
||||
const buttons = page.locator('button:visible');
|
||||
const count = await buttons.count();
|
||||
|
||||
let smallButtonCount = 0;
|
||||
for (let i = 0; i < Math.min(count, 10); i++) {
|
||||
const button = buttons.nth(i);
|
||||
const box = await button.boundingBox();
|
||||
if (box && (box.width < 28 || box.height < 28)) {
|
||||
smallButtonCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Allow some small buttons (icons) but not too many
|
||||
expect(smallButtonCount).toBeLessThan(3);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test.describe('Mobile Interactions', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await setAuthToken(page);
|
||||
await page.setViewportSize({ width: 375, height: 667 });
|
||||
await page.goto('/');
|
||||
await page.waitForLoadState('domcontentloaded');
|
||||
});
|
||||
|
||||
test('can switch between tabs', async ({ page }) => {
|
||||
const urlTab = page.locator('button:has-text("URL")');
|
||||
if (await urlTab.count() > 0) {
|
||||
await urlTab.first().click();
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// URL input should now be visible
|
||||
const urlInput = page.locator('input[type="url"], input[placeholder*="youtube"], input[placeholder*="URL"]');
|
||||
if (await urlInput.count() > 0) {
|
||||
await expect(urlInput.first()).toBeVisible();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('can type in input fields', async ({ page }) => {
|
||||
// Find a text input (not file input)
|
||||
const textInput = page.locator('input[type="text"], input[placeholder*="Artist"], input[placeholder*="title"]');
|
||||
if (await textInput.count() > 0) {
|
||||
await textInput.first().focus();
|
||||
await textInput.first().fill('Test Input');
|
||||
await expect(textInput.first()).toHaveValue('Test Input');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Accessibility', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await setAuthToken(page);
|
||||
await page.setViewportSize({ width: 375, height: 667 });
|
||||
await page.goto('/');
|
||||
await page.waitForLoadState('domcontentloaded');
|
||||
});
|
||||
|
||||
test('has proper viewport meta tag', async ({ page }) => {
|
||||
const viewportMeta = await page.evaluate(() => {
|
||||
const meta = document.querySelector('meta[name="viewport"]');
|
||||
return meta?.getAttribute('content') || '';
|
||||
});
|
||||
|
||||
expect(viewportMeta).toContain('width=device-width');
|
||||
expect(viewportMeta).toContain('initial-scale=1');
|
||||
});
|
||||
});
|
||||
@@ -82,6 +82,15 @@ export default defineConfig({
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
// Mobile device testing
|
||||
{
|
||||
name: 'mobile-chrome',
|
||||
use: { ...devices['Pixel 7'] },
|
||||
},
|
||||
{
|
||||
name: 'mobile-safari',
|
||||
use: { ...devices['iPhone 14'] },
|
||||
},
|
||||
],
|
||||
|
||||
// Run local dev server before starting tests
|
||||
|
||||
@@ -576,6 +576,143 @@
|
||||
font-size: 1.5rem;
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
/* Mobile responsiveness */
|
||||
@media (max-width: 768px) {
|
||||
.app {
|
||||
padding: 12px;
|
||||
gap: 8px;
|
||||
height: auto;
|
||||
min-height: 100vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.logo-img {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.waveform-player {
|
||||
flex: none;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.waveform-toolbar {
|
||||
flex-wrap: wrap;
|
||||
padding: 8px 12px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.toolbar-left,
|
||||
.toolbar-center,
|
||||
.toolbar-right {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.audio-toggle-group {
|
||||
order: 10;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.bottom-section {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.mute-panel {
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.selection-panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.selection-option {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
min-height: 44px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
|
||||
.audio-toggle {
|
||||
padding: 8px 12px;
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.zoom-btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.time-display {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.app {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.track-info {
|
||||
width: 100%;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.waveform-toolbar {
|
||||
padding: 6px 8px;
|
||||
}
|
||||
|
||||
.toolbar-center {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
order: -1;
|
||||
}
|
||||
|
||||
.toolbar-left {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
order: 2;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -148,12 +148,14 @@ export default function Header({
|
||||
gap: 1,
|
||||
mb: 1,
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
height: '140px'
|
||||
height: isMobile ? 'auto' : '140px',
|
||||
minHeight: isMobile ? 'auto' : '140px'
|
||||
}}>
|
||||
<Box sx={{
|
||||
width: '280px',
|
||||
width: isMobile ? '100%' : '280px',
|
||||
minWidth: isMobile ? '100%' : '280px',
|
||||
position: 'relative',
|
||||
height: '100%'
|
||||
height: isMobile ? 'auto' : '100%'
|
||||
}}>
|
||||
{isAgenticMode ? (
|
||||
<AgenticCorrectionMetrics
|
||||
@@ -261,10 +263,11 @@ export default function Header({
|
||||
}}>
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
gap: 1,
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
alignItems: isMobile ? 'flex-start' : 'center',
|
||||
height: '32px'
|
||||
gap: 0.5,
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
alignItems: 'center',
|
||||
minHeight: '32px'
|
||||
}}>
|
||||
<ModeSelector
|
||||
effectiveMode={effectiveMode}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "karaoke-gen"
|
||||
version = "0.76.24"
|
||||
version = "0.76.25"
|
||||
description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens."
|
||||
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
|
||||
license = "MIT"
|
||||
|
||||
Reference in new issue
Block a user