Merge pull request 'fix: resolve {{count}} interpolation and add notification bell for parapharmacy products' (#50) from fix/parapharmacy-i18n-interpolation-and-bell into main
Build & Push Docker Images / Detect Changes (push) Successful in 10s
Build & Push Docker Images / Backend Tests (push) Has been skipped
Build & Push Docker Images / Parapharmacy API Tests (push) Has been skipped
Build & Push Docker Images / Pip Platform Tests (push) Has been skipped
Build & Push Docker Images / Frontend Tests (push) Successful in 1m40s
Build & Push Docker Images / Build Backend (push) Has been skipped
Build & Push Docker Images / Build Parapharmacy API (push) Has been skipped
Build & Push Docker Images / Build Pip Platform (push) Has been skipped
Build & Push Docker Images / Build Frontend (push) Successful in 44s
Build & Push Docker Images / Deploy (push) Successful in 37s

Reviewed-on: #50
This commit was merged in pull request #50.
This commit is contained in:
2026-07-17 13:34:37 +00:00
4 changed files with 22 additions and 9 deletions
@@ -36,8 +36,14 @@ export function LanguageProvider({ children }) {
AsyncStorage.setItem(STORAGE_KEY, newLang).catch(() => {});
}, []);
const t = useCallback((key) => {
return locales[lang]?.[key] || locales.es[key] || key;
const t = useCallback((key, params) => {
let str = locales[lang]?.[key] || locales.es[key] || key;
if (params && typeof str === 'string') {
Object.keys(params).forEach((k) => {
str = str.replace(new RegExp(`\\{\\{${k}\\}\\}`, 'g'), params[k]);
});
}
return str;
}, [lang]);
const value = useMemo(() => ({ lang, setLang, t, ready }), [lang, setLang, t, ready]);
+2
View File
@@ -195,6 +195,8 @@ function App() {
source={productScreen?.source}
id={productScreen?.id}
onBack={() => { setProductScreen(null); setScreen('search'); }}
currentUser={currentUser}
onLoginRequest={() => setShowLogin(true)}
/>
);
break;
+8 -2
View File
@@ -26,8 +26,14 @@ export function LanguageProvider({ children }) {
} catch {}
}, []);
const t = useCallback((key) => {
return locales[lang]?.[key] || locales.es[key] || key;
const t = useCallback((key, params) => {
let str = locales[lang]?.[key] || locales.es[key] || key;
if (params && typeof str === 'string') {
Object.keys(params).forEach((k) => {
str = str.replace(new RegExp(`\\{\\{${k}\\}\\}`, 'g'), params[k]);
});
}
return str;
}, [lang]);
const value = useMemo(() => ({ lang, setLang, t }), [lang, setLang, t]);
+4 -5
View File
@@ -5,7 +5,7 @@ import { haversineKm, getUserPosition, hasCachedPosition } from '../utils/geo';
import { useTranslation } from '../i18n';
import './ProductView.css';
export default function ProductView({ source, id, onBack }) {
export default function ProductView({ source, id, onBack, currentUser, onLoginRequest }) {
const { t } = useTranslation();
const [product, setProduct] = useState(null);
const [loading, setLoading] = useState(true);
@@ -196,10 +196,6 @@ export default function ProductView({ source, id, onBack }) {
<div className="pharmacies-loading">{t('productView.loadingPharmacies')}</div>
) : pharmacies.length > 0 ? (
<>
<h3 className="pharmacies-title">
{t('productView.availableInPharmacies', { count: pharmacies.length })}
</h3>
<div className="pharmacy-controls">
<button
className={`sort-distance-button ${sortByDistance ? 'active' : ''}`}
@@ -231,6 +227,9 @@ export default function ProductView({ source, id, onBack }) {
pharmacies={displayedPharmacies}
loading={loadingPharmacies}
userPosition={sortByDistance ? userPosition : null}
medicine={product}
currentUser={currentUser}
onLoginRequest={onLoginRequest}
/>
</>
) : null}