@autobusal/common 1.4.5 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { useState, useRef, ChangeEvent, KeyboardEvent } from 'react';
1
+ import { useState, useRef, useEffect, ChangeEvent, KeyboardEvent } from 'react';
2
2
  import { TFunction } from 'i18next';
3
3
  import { UseFormRegister, UseFormSetValue } from 'react-hook-form';
4
4
  import { useOutside } from '@autobusal/hooks';
@@ -31,6 +31,21 @@ const Autocomplete = ({ name, defaultValue, data, validation, t, refs, onUpdate
31
31
 
32
32
  useOutside(ref, () => setShow(false));
33
33
 
34
+ // `data` is rebuilt with fresh (locale-specific) names whenever the
35
+ // language changes, but `q` is plain component state that React won't
36
+ // resync on its own - without this, a selected station keeps showing
37
+ // its display name in the language that was active at selection time.
38
+ useEffect(() => {
39
+ if (value) {
40
+ const match = data.find(item => item.value === value);
41
+
42
+ if (match) {
43
+ setQ(match.name);
44
+ }
45
+ }
46
+ // eslint-disable-next-line react-hooks/exhaustive-deps
47
+ }, [ data ]);
48
+
34
49
  const options = data.filter(item => {
35
50
  return item.name.toLowerCase().indexOf(q.toLowerCase()) > -1;
36
51
  });
@@ -2,7 +2,7 @@ import { TFunction } from 'i18next';
2
2
  import { FiCalendar } from 'react-icons/fi';
3
3
  import { sanitizeHtml } from '@autobusal/utilities';
4
4
  import Image from './Image';
5
- import { LinkTitle, Details, DisplayDate, TextPreview, TextView, ButtonLink } from './styles';
5
+ import { LinkTitle, Title, Details, DisplayDate, TextPreview, TextView, ButtonLink } from './styles';
6
6
  import { ArticleData } from '@autobusal/providers/types/articles';
7
7
 
8
8
  interface Props {
@@ -13,9 +13,12 @@ interface Props {
13
13
 
14
14
  const BlogItem = ({ article, type, t }: Props): JSX.Element => (
15
15
  <div className="box">
16
- { article.image_url !== null && <Image type={ type } internal={ article.internal } image_url={ article.image_url } /> }
16
+ { article.image_url !== null && <Image type={ type } internal={ article.internal } image_url={ article.image_url } title={ article.title } /> }
17
17
 
18
- <LinkTitle to={ `/blog/article/${ article.internal }` }>{ article.title }</LinkTitle>
18
+ { type === 'view'
19
+ ? <Title>{ article.title }</Title>
20
+ : <LinkTitle to={ `/blog/article/${ article.internal }` }>{ article.title }</LinkTitle>
21
+ }
19
22
 
20
23
  <Details>
21
24
  <DisplayDate>
@@ -4,19 +4,20 @@ interface Props {
4
4
  type: 'preview' | 'view' | 'short'
5
5
  internal: string
6
6
  image_url: string
7
+ title: string
7
8
  }
8
9
 
9
- const Image = ({ type, internal, image_url }: Props): JSX.Element => {
10
+ const Image = ({ type, internal, image_url, title }: Props): JSX.Element => {
10
11
  if (type === 'preview' || type === 'short') {
11
12
  return (
12
13
  <ImageLink to={ `/blog/article/${ internal }` }>
13
- <ContainerImage src={ image_url } />
14
+ <ContainerImage src={ image_url } alt={ title } />
14
15
  </ImageLink>
15
16
  );
16
17
  }
17
18
 
18
19
  return (
19
- <ContainerImage src={ image_url } />
20
+ <ContainerImage src={ image_url } alt={ title } />
20
21
  );
21
22
  };
22
23
 
@@ -28,6 +28,14 @@ export const LinkTitle = styled(Link)`
28
28
  }
29
29
  `;
30
30
 
31
+ // Single-article view renders the title as a real <h1> instead of a
32
+ // self-link back to the same page - same visual weight as LinkTitle.
33
+ export const Title = styled.h1`
34
+ font-size: ${ props => props.theme.size.xl };
35
+ font-weight: 700;
36
+ margin: 0;
37
+ `;
38
+
31
39
  export const Details = styled.div`
32
40
  display: flex;
33
41
  gap: 15px;
package/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to `@autobusal/common` are documented here. This project follows
4
4
  [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [1.4.7] - 2026-07-30
7
+
8
+ ### Fixed
9
+
10
+ - **Blog thumbnails missing `alt` text (`BlogItem/Image.tsx`).** Neither the
11
+ preview/short grid thumbnail nor the full article image had `alt` - added a
12
+ required `title` prop (threaded through from `BlogItem.tsx`'s
13
+ `article.title`) used as the `alt` text on both.
14
+
15
+ ## [1.4.6] - 2026-07-29
16
+
17
+ ### Fixed
18
+
19
+ - `Autocomplete/Autocomplete.tsx`: the "From"/"To" route-search inputs kept showing a station's display name in the language that was active when it was selected, since the displayed text (`q`) was plain component state that never resynced when `data` was rebuilt with fresh, relocalized names after a language switch (e.g. "(Alle Stationen)" stayed baked in after switching German -> English). Now re-derives the display name from the selected `value` whenever `data` changes.
20
+
6
21
  ## [1.4.5] - 2026-07-28
7
22
 
8
23
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"