mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
feat(help): rewrite the help center for v5 with a Tours section, new pictures in every language, and fix the tour planner bugs it surfaced
Every help screen checked against the v5 redesign. Tours is documented for the first time, as a screen of its own with twelve screens under it, and notifications get help of their own. All pictures are taken again on a realistic demo trip, with short loops where a still cannot show the motion. The English is plain and every language is written naturally rather than word for word. The switcher shows two levels at most, a screen's overview lists its sub-screens as cards above its guides, each wiki page is linked once, and the help sidebar is wider. Fixes found along the way: Save to Collection keeps a tour's route, a track dropped on the places column opens the Tours import, tour Share on desktop, the unsaved tour draft lives on the account, a route click no longer adds an end point, Trip places leaves the trip's tours out, Escape closes a stage's day menu, confirms before destructive deletes, DWD warnings sharing one id kept apart, a booking's date moves with it, and smaller fixes across notifications, bookings, the day plan, stays, Atlas, Collections, Vacay and the admin screens.
This commit is contained in:
@@ -92,6 +92,17 @@ describe('PackingListPanel', () => {
|
||||
expect(screen.getByText(/1 of 2 packed/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-COMP-PACKING-006b: the progress total counts the open list only, not my list as well', () => {
|
||||
const items = [
|
||||
buildPackingItem({ name: 'Item1', checked: 1 }),
|
||||
buildPackingItem({ name: 'Item2', checked: 0 }),
|
||||
buildPackingItem({ name: 'Mine1', checked: 0, is_private: 1 }),
|
||||
buildPackingItem({ name: 'Mine2', checked: 0, is_private: 1 }),
|
||||
];
|
||||
render(<PackingListPanel tripId={1} items={items} />);
|
||||
expect(screen.getByText(/1 of 2 packed/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-COMP-PACKING-007: shows progress bar for packed items', () => {
|
||||
const items = [
|
||||
buildPackingItem({ name: 'Item1', checked: 1 }),
|
||||
|
||||
@@ -7,7 +7,7 @@ import { PackingTemplateOption } from './PackingTemplateOption'
|
||||
|
||||
export function PackingHeader(S: PackingState) {
|
||||
const {
|
||||
inlineHeader, t, items, abgehakt, fortschritt, canEdit, isAdmin,
|
||||
inlineHeader, t, items, abgehakt, fortschritt, viewTotal, canEdit, isAdmin,
|
||||
showSaveTemplate, saveTemplateName, setSaveTemplateName, handleSaveAsTemplate, setShowSaveTemplate,
|
||||
setShowImportModal, handleClearChecked, availableTemplates, templateDropdownRef,
|
||||
showTemplateDropdown, setShowTemplateDropdown, applyingTemplate, handleApplyTemplate,
|
||||
@@ -22,7 +22,7 @@ export function PackingHeader(S: PackingState) {
|
||||
<h2 style={{ margin: 0, fontSize: 'calc(18px * var(--fs-scale-subtitle, 1))', fontWeight: 700, color: 'var(--text-primary)' }}>{t('packing.title')}</h2>
|
||||
{items.length > 0 && (
|
||||
<p style={{ margin: '2px 0 0', fontSize: 'calc(12.5px * var(--fs-scale-body, 1))', color: 'var(--text-faint)' }}>
|
||||
{t('packing.progress', { packed: abgehakt, total: items.length, percent: fortschritt })}
|
||||
{t('packing.progress', { packed: abgehakt, total: viewTotal, percent: fortschritt })}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -194,7 +194,7 @@ describe('usePackingItemActions', () => {
|
||||
expect(toast.error).toHaveBeenCalledWith('packing.toast.deleteError');
|
||||
});
|
||||
|
||||
it('FE-PACK-ITEMACT-010: clearing removes every checked item of the trip, in both views', async () => {
|
||||
it('FE-PACK-ITEMACT-010: clearing removes the checked items of the open view and leaves the other view alone', async () => {
|
||||
const items = [
|
||||
buildPackingItem({ id: 1, checked: 1 }),
|
||||
buildPackingItem({ id: 2, checked: 0 }),
|
||||
@@ -204,7 +204,7 @@ describe('usePackingItemActions', () => {
|
||||
await act(async () => {
|
||||
await result.current.clearChecked();
|
||||
});
|
||||
expect(acts.deletePackingItem.mock.calls.map((c) => c[1])).toEqual([1, 3]);
|
||||
expect(acts.deletePackingItem.mock.calls.map((c) => c[1])).toEqual([1]);
|
||||
expect(toast.error).not.toHaveBeenCalled();
|
||||
acts.deletePackingItem.mockRejectedValueOnce(new Error('x'));
|
||||
await act(async () => {
|
||||
|
||||
@@ -2,7 +2,12 @@ import { useState } from 'react';
|
||||
|
||||
import { useTripStore, type TripStoreState } from '../../store/tripStore';
|
||||
import type { PackingItem } from '../../types';
|
||||
import { isLastCustomItemInCategory, isPackingPlaceholder, type PackingView } from './packingListModel';
|
||||
import {
|
||||
isLastCustomItemInCategory,
|
||||
isPackingPlaceholder,
|
||||
packingViewItems,
|
||||
type PackingView,
|
||||
} from './packingListModel';
|
||||
import { PACKING_PLACEHOLDER_NAME } from './packingListPanel.constants';
|
||||
import { newItemSharing } from './packingListPanel.helpers';
|
||||
|
||||
@@ -128,10 +133,10 @@ export function usePackingItemActions({
|
||||
if (failed) toast.error(t('packing.toast.deleteError'));
|
||||
};
|
||||
|
||||
/** Removes every checked item of the trip, not only those of the active view. */
|
||||
/** Removes the checked items of the open view only, the ones the button's count names. */
|
||||
const clearChecked = async () => {
|
||||
let failed = false;
|
||||
for (const item of items.filter((i) => i.checked)) {
|
||||
for (const item of packingViewItems(items, view).filter((i) => i.checked)) {
|
||||
try {
|
||||
await deletePackingItem(tripId, item.id);
|
||||
} catch {
|
||||
|
||||
@@ -104,7 +104,7 @@ export function usePackingList({ tripId, items, openImportSignal = 0, addCategor
|
||||
return groups
|
||||
}, [viewItems, filter, sort, locale, t])
|
||||
|
||||
const { checked: abgehakt, pct: fortschritt } = packingProgress(viewItems)
|
||||
const { checked: abgehakt, pct: fortschritt, total: viewTotal } = packingProgress(viewItems)
|
||||
|
||||
// A category dropped onto another takes its place; the slice reorders
|
||||
// optimistically and rolls back with a toast of its own.
|
||||
@@ -220,7 +220,7 @@ export function usePackingList({ tripId, items, openImportSignal = 0, addCategor
|
||||
handleSetSharing, handleCloneItem, handleJoinItem, handleLeaveItem,
|
||||
tripId, items, inlineHeader, t, canEdit, isAdmin, font, reorderPackingItems,
|
||||
filter, setFilter, sort, setSort, addingCategory, setAddingCategory, newCatName, setNewCatName,
|
||||
tripMembers, categoryAssignees, handleSetAssignees, allCategories, gruppiert, abgehakt, fortschritt, moveCategory,
|
||||
tripMembers, categoryAssignees, handleSetAssignees, allCategories, gruppiert, abgehakt, fortschritt, viewTotal, moveCategory,
|
||||
handleAddItemToCategory, handleAddNewCategory, handleRenameCategory, handleDeleteCategory, handleDeleteItem, handleClearChecked,
|
||||
bagTrackingEnabled, bags, unassignedWeightGrams, serverWeightsFresh, newBagName, setNewBagName, showAddBag, setShowAddBag, showBagModal, setShowBagModal,
|
||||
handleCreateBag, handleCreateBagByName, handleDeleteBag, handleUpdateBag, handleSetBagMembers,
|
||||
|
||||
Reference in New Issue
Block a user