guest pwa: hide tasks when inactive and improve empty gallery state
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-02-08 21:53:47 +01:00
parent 6cc463fc70
commit 83cf863548
6 changed files with 228 additions and 5 deletions

View File

@@ -135,6 +135,7 @@ describe('HomeScreen', () => {
fetchGalleryMock.mockResolvedValueOnce({ data: [] });
useEventDataMock.mockReturnValue({
tasksEnabled: true,
hasActiveTasks: true,
token: 'demo',
event: { name: 'Demo Event' },
});
@@ -149,6 +150,7 @@ describe('HomeScreen', () => {
fetchGalleryMock.mockResolvedValueOnce({ data: [] });
useEventDataMock.mockReturnValue({
tasksEnabled: false,
hasActiveTasks: false,
token: 'demo',
event: { name: 'Demo Event' },
});
@@ -165,6 +167,7 @@ describe('HomeScreen', () => {
});
useEventDataMock.mockReturnValue({
tasksEnabled: false,
hasActiveTasks: false,
token: 'demo',
event: { name: 'Demo Event' },
});
@@ -176,4 +179,34 @@ describe('HomeScreen', () => {
expect(navigateMock).toHaveBeenCalledWith('/e/demo/gallery?photo=42');
});
it('does not mention tasks when no active tasks are available', () => {
fetchGalleryMock.mockResolvedValueOnce({ data: [] });
useEventDataMock.mockReturnValue({
tasksEnabled: true,
hasActiveTasks: false,
token: 'demo',
event: { name: 'Demo Event' },
});
render(<HomeScreen />);
expect(screen.getByText('Capture ready')).toBeInTheDocument();
expect(screen.queryByText("Let's go!")).not.toBeInTheDocument();
});
it('shows a friendly empty gallery message instead of placeholders', async () => {
fetchGalleryMock.mockResolvedValueOnce({ data: [] });
useEventDataMock.mockReturnValue({
tasksEnabled: false,
hasActiveTasks: false,
token: 'demo',
event: { name: 'Demo Event' },
});
render(<HomeScreen />);
expect(await screen.findByText('No photos yet')).toBeInTheDocument();
expect(screen.getByText('You should start taking some and fill this gallery with moments.')).toBeInTheDocument();
});
});