Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/docs/src/components/try-map/langs/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ const pack: Pack = {
rack_42u: 'Serverschrank 42 HE',
box: 'Aufbewahrungsbox',
washer: 'Waschmaschine',
water_purifier: 'Wasserfilteranlage',
workbench: 'Werkbank',
tool_wall: 'Werkzeugwand',
wall_tv: 'Wandfernseher',
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/components/try-map/langs/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ const pack: Pack = {
rack_42u: 'Bastidor de servidor 42U',
box: 'Caja de almacenamiento',
washer: 'Lavadora',
water_purifier: 'Purificador de agua',
workbench: 'Banco de trabajo',
tool_wall: 'Pared de herramientas',
wall_tv: 'TV de pared',
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/components/try-map/langs/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ const pack: Pack = {
rack_42u: 'Baie serveur 42U',
box: 'Boîte de rangement',
washer: 'Lave-linge',
water_purifier: 'Purificateur d’eau',
workbench: 'Établi',
tool_wall: 'Panneau à outils',
wall_tv: 'Télé murale',
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/components/try-map/langs/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ const pack: Pack = {
rack_42u: 'Armadio rack 42U',
box: 'Scatola',
washer: 'Lavatrice',
water_purifier: 'Depuratore d’acqua',
workbench: 'Banco da lavoro',
tool_wall: 'Parete attrezzi',
wall_tv: 'TV a parete',
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/components/try-map/langs/uk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ const pack: Pack = {
rack_42u: 'Серверна стійка 42U',
box: 'Коробка для зберігання',
washer: 'Пральна машина',
water_purifier: 'Очищувач води',
workbench: 'Верстак',
tool_wall: 'Стіна з інструментами',
wall_tv: 'Настінний телевізор',
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/components/try-map/langs/vi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ const pack: Pack = {
rack_42u: 'Tủ rack máy chủ 42U',
box: 'Hộp lưu trữ',
washer: 'Máy giặt',
water_purifier: 'Máy lọc nước',
workbench: 'Bàn thợ',
tool_wall: 'Tường dụng cụ',
wall_tv: 'TV treo tường',
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/components/try-map/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const MODEL_NAMES: Record<MapModelKey, Two> = {
rack_42u: ['Server rack 42U', 'خزانة سيرفر ٤٢ وحدة'],
box: ['Storage box', 'صندوق تخزين'],
washer: ['Washing machine', 'غسالة'],
water_purifier: ['Water purifier', 'جهاز تنقية مياه'],
workbench: ['Workbench', 'طاولة عمل'],
tool_wall: ['Tool wall', 'جدار الأدوات'],
wall_tv: ['Wall TV', 'تلفزيون حائط'],
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/locales/ar/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -29296,3 +29296,7 @@ msgstr "القراءات المحوّلة"
#: src/components/history/labels.ts
msgid "Meter unit changed"
msgstr "تغيّرت وحدة العدّاد"

#: src/map/labels.ts
msgid "Water purifier"
msgstr "جهاز تنقية مياه"
4 changes: 4 additions & 0 deletions apps/web/src/locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -29296,3 +29296,7 @@ msgstr "Umgerechnete Zählerstände"
#: src/components/history/labels.ts
msgid "Meter unit changed"
msgstr "Zählereinheit geändert"

#: src/map/labels.ts
msgid "Water purifier"
msgstr "Wasserfilteranlage"
4 changes: 4 additions & 0 deletions apps/web/src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -29296,3 +29296,7 @@ msgstr "Readings converted"
#: src/components/history/labels.ts
msgid "Meter unit changed"
msgstr "Meter unit changed"

#: src/map/labels.ts
msgid "Water purifier"
msgstr "Water purifier"
4 changes: 4 additions & 0 deletions apps/web/src/locales/es/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -29296,3 +29296,7 @@ msgstr "Lecturas convertidas"
#: src/components/history/labels.ts
msgid "Meter unit changed"
msgstr "Unidad del medidor cambiada"

#: src/map/labels.ts
msgid "Water purifier"
msgstr "Purificador de agua"
4 changes: 4 additions & 0 deletions apps/web/src/locales/fr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -29296,3 +29296,7 @@ msgstr "Relevés convertis"
#: src/components/history/labels.ts
msgid "Meter unit changed"
msgstr "Unité du compteur modifiée"

#: src/map/labels.ts
msgid "Water purifier"
msgstr "Purificateur d’eau"
4 changes: 4 additions & 0 deletions apps/web/src/locales/it/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -29296,3 +29296,7 @@ msgstr "Letture convertite"
#: src/components/history/labels.ts
msgid "Meter unit changed"
msgstr "Unità del contatore cambiata"

#: src/map/labels.ts
msgid "Water purifier"
msgstr "Depuratore d’acqua"
4 changes: 4 additions & 0 deletions apps/web/src/locales/uk/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -31279,3 +31279,7 @@ msgstr "Перераховані показники"
#: src/components/history/labels.ts
msgid "Meter unit changed"
msgstr "Одиницю лічильника змінено"

#: src/map/labels.ts
msgid "Water purifier"
msgstr "Очищувач води"
4 changes: 4 additions & 0 deletions apps/web/src/locales/vi/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -21345,3 +21345,7 @@ msgstr "Chỉ số đã quy đổi"
#: src/components/history/labels.ts
msgid "Meter unit changed"
msgstr "Đã đổi đơn vị đồng hồ đo"

#: src/map/labels.ts
msgid "Water purifier"
msgstr "Máy lọc nước"
23 changes: 23 additions & 0 deletions apps/web/src/map/engine/draw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ export function materials() {
glass: mat('glass', { color: 0xbfd6e2, roughness: 0.05, transparent: true, opacity: 0.35 }),
white: mat('white', { color: 0xf6f5f1, roughness: 0.4 }),
appliance: mat('appliance', { color: 0xe9e9e6, roughness: 0.3, metalness: 0.1 }),
/** A dark grey appliance's body (the water purifier, #443). */
graphite: mat('graphite', { color: 0x3a3d43, roughness: 0.35, metalness: 0.2 }),
ceramic: mat('ceramic', { color: 0xefeae1, roughness: 0.3 }),
terracotta: mat('terracotta', { color: 0xb0643f, roughness: 0.75 }),
soil: mat('soil', { color: 0x4a3726, roughness: 1 }),
Expand Down Expand Up @@ -1200,6 +1202,27 @@ export function drawnModels(F: Materials): Record<string, Build> {
rb(g, 0.2, 0.08, 0.01, 0.15, 0.76, d + 0.004, F.white, 0.008);
cy(g, 0.035, 0.035, 0.03, w - 0.12, 0.76, d + 0.01, F.chrome, Math.PI / 2);
},
/**
* A water purifier on the floor (#443): a dark cabinet on a recessed plinth with a brass band,
* a glass top with its buttons along the front edge, and at the back a panel with a lit
* display, the tap under it and a brass handle on top.
*/
water_purifier(g, w, d) {
const top = 1.088;
rb(g, w - 0.02, 0.03, d - 0.03, w / 2, 0.015, (d - 0.03) / 2, F.black, 0);
rb(g, w, top - 0.03, d, w / 2, (top + 0.03) / 2, d / 2, F.graphite, 0.012);
rb(g, w - 0.01, 0.027, 0.004, w / 2, 0.62, d + 0.002, F.brass, 0.002);
rb(g, w, 0.012, d, w / 2, top + 0.006, d / 2, F.blackGloss, 0.004);
rb(g, w - 0.08, 0.02, 0.003, w / 2, top - 0.022, d + 0.0015, F.screen, 0.002);
for (const k of [-1, 0, 1]) sp(g, 0.003, w / 2 + k * 0.03, top - 0.022, d + 0.003, F.glow);
const panel = 0.18;
const py = top + 0.012 + panel / 2;
rb(g, w - 0.02, panel, 0.05, w / 2, py, 0.04, F.graphite, 0.01);
rb(g, 0.08, 0.035, 0.003, w / 2, py + 0.05, 0.0665, F.screenLit, 0.002);
cy(g, 0.008, 0.008, 0.04, w / 2, py - 0.06, 0.085, F.chrome, Math.PI / 2);
cy(g, 0.006, 0.006, 0.03, w / 2, py - 0.075, 0.1, F.chrome);
rb(g, w * 0.55, 0.014, 0.045, w * 0.6, top + 0.012 + panel + 0.003, 0.04, F.brass, 0.006);
},
workbench(g, w, d) {
rb(g, w, 0.06, d, w / 2, 0.89, d / 2, F.butcher, 0.01);
for (const x of [0.06, w - 0.06])
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/map/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export function useModelNames(): Record<MapModelKey, string> {
rack_42u: t`Server rack 42U`,
box: t`Storage box`,
washer: t`Washing machine`,
water_purifier: t`Water purifier`,
workbench: t`Workbench`,
tool_wall: t`Tool wall`,
wall_tv: t`Wall TV`,
Expand Down
19 changes: 19 additions & 0 deletions apps/web/src/map/models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,22 @@ describe('the homelab shapes (#171)', () => {
}
});
});

describe('the water purifier (#443)', () => {
it('is drawn in code, filling its own size and no more', async () => {
vi.spyOn(HTMLCanvasElement.prototype, 'getContext').mockReturnValue(null);
const THREE = await import('three');
const { drawnModels, materials } = await import('./engine/draw');
const build = drawnModels(materials()).water_purifier;
expect(build).toBeTypeOf('function');
const m = mapModel('water_purifier');
const g = new THREE.Group();
build?.(g, m.w, m.d);
const size = new THREE.Box3().setFromObject(g).getSize(new THREE.Vector3());
// Its tap and buttons stand a few millimetres proud of its front.
expect(size.x).toBeCloseTo(m.w, 2);
expect(size.y).toBeCloseTo(m.h ?? 0, 2);
expect(size.z).toBeGreaterThanOrEqual(m.d - 0.005);
expect(size.z).toBeLessThanOrEqual(m.d + 0.01);
});
});
Binary file modified apps/web/src/map/thumbs/shapes.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 20 additions & 18 deletions apps/web/src/map/thumbs/sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,25 @@ export const THUMB_CELLS: Readonly<Record<MapModelKey, number>> = {
rack_42u: 74,
box: 75,
washer: 76,
workbench: 77,
tool_wall: 78,
wall_tv: 79,
wall_shelf: 80,
wall_cabinet: 81,
rack_wall_6u: 82,
rack_wall_12u: 83,
picture: 84,
clock: 85,
hooks: 86,
car: 87,
bike: 88,
water_tank: 89,
dish: 90,
stairs: 91,
stairwell: 92,
zone: 93,
item: 94,
water_purifier: 77,
workbench: 78,
tool_wall: 79,
wall_tv: 80,
wall_shelf: 81,
wall_cabinet: 82,
rack_wall_6u: 83,
rack_wall_12u: 84,
picture: 85,
clock: 86,
hooks: 87,
car: 88,
bike: 89,
water_tank: 90,
dish: 91,
stairs: 92,
stairwell: 93,
zone: 94,
item: 95,
};

/** Each shape's height as drawn, in centimetres, from its rendered bounds. */
Expand Down Expand Up @@ -186,6 +187,7 @@ export const THUMB_HEIGHTS_CM: Readonly<Record<MapModelKey, number>> = {
rack_42u: 200,
box: 34.2,
washer: 85,
water_purifier: 129,
workbench: 92,
tool_wall: 60,
wall_tv: 71,
Expand Down
96 changes: 96 additions & 0 deletions packages/shared/src/map-shapes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1003,3 +1003,99 @@ describe('suggestShapes: what a thing is for, in Spanish and Vietnamese', () =>
expect(named.map((s) => s.model)).not.toContain('printer');
});
});

describe('a water purifier standing on the floor (#443)', () => {
it.each([
['Water purifier', 'water_purifier'],
['Kitchen water purifier', 'water_purifier'],
['Water filtration system', 'water_purifier'],
['Water dispenser', 'water_purifier'],
['Purificateur d’eau', 'water_purifier'],
['Fontaine à eau', 'water_purifier'],
['Wasserspender', 'water_purifier'],
['Depuratore d’acqua', 'water_purifier'],
['Purificador de agua', 'water_purifier'],
['Очищувач води', 'water_purifier'],
['Máy lọc nước', 'water_purifier'],
['جهاز تنقية المياه', 'water_purifier'],
['جهاز تنقية مياه', 'water_purifier'],
['Wasserfilteranlage', 'water_purifier'],
] as const)('%s gets the %s, given by itself', (name, model) => {
const s = suggestShapes({ name });
expect(s.shapes[0]).toMatchObject({ model, from: 'name' });
expect(s.confident).toBe(true);
});

it('is not sure about a filter cartridge, and keeps the water tank its own', () => {
expect(sure({ name: 'Water filter cartridge' })).toBe(false);
expect(first({ name: 'Water tank' })).toBe('water_tank');
expect(first({ name: 'Bồn nước' })).toBe('water_tank');
});

// A water filter is as often a jug, a cartridge or a tap's as the cabinet on the floor: the
// plain filter words don't name it, and what these got before the shape came, they still get.
it.each([
'Water filter',
'Water filter jug',
'Water filter pitcher',
'Brita water filter',
'Shower water filter',
'Water filter replacement',
'Wasserfilter',
'Wasserfilter Kanne',
'Wasserfilter Kartusche',
'Carafe filtre à eau',
'Jarra filtro de agua',
"Filtro per l'acqua",
'Фільтр для води',
'Bình lọc nước',
'فلتر مياه',
'Pet water dispenser',
'Fontaine à eau pour chat',
])('gives %s no water purifier', (name) => {
expect(shapeOnAdd({ name })).toEqual({ model: 'item', from: 'guess' });
expect(suggestShapes({ name }).shapes.map((x) => x.model)).not.toContain('water_purifier');
});

it('never gives a thing of the Filters type the water purifier', () => {
// The sample household's filter (apps/server/src/seed/inventory.ts) keeps its box.
for (const name of ['Water filter cartridge', 'Water filter', 'Water purifier filter'])
expect(shapeOnAdd({ name, typeKey: 'filters' }), name).toEqual({
model: 'box',
from: 'guess',
});
expect(
suggestShapes({ name: 'Water purifier', typeKey: 'filters' }).shapes.map((x) => x.model),
).not.toContain('water_purifier');
// As the map's server reads it: the type's key and its name.
expect(
shapeOnAdd({ name: 'Water filter cartridge', typeKey: 'filters', typeName: 'Filters' }),
).toEqual({ model: 'box', from: 'guess' });
});

it('is only a guess for a jug, a cartridge or a replacement named after it', () => {
for (const name of [
'Water purifier cartridge',
'Water purifier replacement',
'Wasserspender Kanne',
])
expect(sure({ name }), name).toBe(false);
});

it('finds it by search in each language, with the kitchen and laundry', () => {
expect(searchShapes('water pur')[0]).toBe('water_purifier');
expect(searchShapes('wasserspen', {}, 'de')[0]).toBe('water_purifier');
expect(searchShapes('máy lọc', {}, 'vi')[0]).toBe('water_purifier');
expect(SHAPE_GROUP.water_purifier).toBe('kitchen');
for (const lang of SHAPE_LANGS)
expect(shapeWordsByLang('water_purifier')[lang].length, lang).toBeGreaterThan(0);
});

it('is drawn at 31 × 36 × 129 cm, standing on the floor', () => {
const m = mapModel('water_purifier');
expect([m.w, m.d, m.h]).toEqual([0.31, 0.36, 1.29]);
expect(m.kind).toBe('thing');
expect(m.small).toBeUndefined();
expect(m.wall).toBeUndefined();
});
});
Loading
Loading