2 Commits

Author SHA1 Message Date
Jimi hackathon
83a0c96d95 removendo lib nao usada 2026-06-27 19:00:20 -03:00
Jimi hackathon
7895f41602 imlementacao traducao 2026-06-27 18:59:15 -03:00
8 changed files with 67 additions and 102 deletions

View File

@@ -1 +1,8 @@
{} {
"atividades":
{
"aspirador": {
"nome": "Faz 1: Liy Dwat la"
}
}
}

View File

@@ -1 +1,8 @@
{} {
"atividades":
{
"aspirador": {
"nome": "Fase 1: A Linha Reta"
}
}
}

View File

@@ -80,10 +80,8 @@
"phaser": "^3.90.0", "phaser": "^3.90.0",
"phaser3-rex-plugins": "^1.80.16", "phaser3-rex-plugins": "^1.80.16",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"react": "^19.2.0",
"react-confetti": "^6.4.0", "react-confetti": "^6.4.0",
"react-dom": "^19.2.0", "react-dom": "^19.2.0",
"react-intl": "^10.1.14",
"react-resizable-panels": "^3.0.6", "react-resizable-panels": "^3.0.6",
"react-router-dom": "^7.9.4", "react-router-dom": "^7.9.4",
"react-shepherd": "^6.1.9", "react-shepherd": "^6.1.9",

118
app/pnpm-lock.yaml generated
View File

@@ -40,7 +40,7 @@ importers:
version: 3.9.1 version: 3.9.1
'@uiw/react-codemirror': '@uiw/react-codemirror':
specifier: 4.25.9 specifier: 4.25.9
version: 4.25.9(@babel/runtime@7.28.4)(@codemirror/autocomplete@6.20.1)(@codemirror/language@6.12.3)(@codemirror/lint@6.9.0)(@codemirror/search@6.5.11)(@codemirror/state@6.6.0)(@codemirror/theme-one-dark@6.1.3)(@codemirror/view@6.41.0)(codemirror@6.0.2)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) version: 4.25.9(@babel/runtime@7.28.4)(@codemirror/autocomplete@6.20.1)(@codemirror/language@6.12.3)(@codemirror/lint@6.9.0)(@codemirror/search@6.5.11)(@codemirror/state@6.6.0)(@codemirror/theme-one-dark@6.1.3)(@codemirror/view@6.41.0)(codemirror@6.0.2)(react-dom@19.2.0)
acorn: acorn:
specifier: ^8.15.0 specifier: ^8.15.0
version: 8.15.0 version: 8.15.0
@@ -58,7 +58,7 @@ importers:
version: 0.546.0 version: 0.546.0
lucide-react: lucide-react:
specifier: ^0.546.0 specifier: ^0.546.0
version: 0.546.0(react@19.2.0) version: 0.546.0
phaser: phaser:
specifier: ^3.90.0 specifier: ^3.90.0
version: 3.90.0 version: 3.90.0
@@ -68,27 +68,21 @@ importers:
prop-types: prop-types:
specifier: ^15.8.1 specifier: ^15.8.1
version: 15.8.1 version: 15.8.1
react:
specifier: ^19.2.0
version: 19.2.0
react-confetti: react-confetti:
specifier: ^6.4.0 specifier: ^6.4.0
version: 6.4.0(react@19.2.0) version: 6.4.0
react-dom: react-dom:
specifier: ^19.2.0 specifier: ^19.2.0
version: 19.2.0(react@19.2.0) version: 19.2.0
react-intl:
specifier: ^10.1.14
version: 10.1.14(@types/react@19.2.2)(react@19.2.0)
react-resizable-panels: react-resizable-panels:
specifier: ^3.0.6 specifier: ^3.0.6
version: 3.0.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0) version: 3.0.6(react-dom@19.2.0)
react-router-dom: react-router-dom:
specifier: ^7.9.4 specifier: ^7.9.4
version: 7.9.4(react-dom@19.2.0(react@19.2.0))(react@19.2.0) version: 7.9.4(react-dom@19.2.0)
react-shepherd: react-shepherd:
specifier: ^6.1.9 specifier: ^6.1.9
version: 6.1.9(react-dom@19.2.0(react@19.2.0))(react@19.2.0)(typescript@5.9.3) version: 6.1.9(react-dom@19.2.0)(typescript@5.9.3)
sentiment: sentiment:
specifier: ^5.0.2 specifier: ^5.0.2
version: 5.0.2 version: 5.0.2
@@ -110,7 +104,7 @@ importers:
version: 6.9.1 version: 6.9.1
'@testing-library/react': '@testing-library/react':
specifier: ^16.3.1 specifier: ^16.3.1
version: 16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@19.2.2(@types/react@19.2.2))(@types/react@19.2.2)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) version: 16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@19.2.2(@types/react@19.2.2))(@types/react@19.2.2)(react-dom@19.2.0)
'@testing-library/user-event': '@testing-library/user-event':
specifier: ^14.6.1 specifier: ^14.6.1
version: 14.6.1(@testing-library/dom@10.4.1) version: 14.6.1(@testing-library/dom@10.4.1)
@@ -1096,18 +1090,6 @@ packages:
'@floating-ui/utils@0.2.10': '@floating-ui/utils@0.2.10':
resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==} resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==}
'@formatjs/fast-memoize@3.1.6':
resolution: {integrity: sha512-H5aexk1Le7T9TPmscacZ+1pR6CTa2n1wq+HDVGXhH8TzUlQQpeXzZs91dRtmFHrbeNbjPFPfQujUqm7MHgVoXQ==}
'@formatjs/icu-messageformat-parser@3.5.12':
resolution: {integrity: sha512-YyzzxVgYJ8DELmmkhn0Yr0rUj0dTJFf9Jp628K3S0ysInBWxLVDOS8i3RP91cCp4DMK4WYb4cVMhWA9i4knSJg==}
'@formatjs/icu-skeleton-parser@2.1.10':
resolution: {integrity: sha512-XuSva+8ZGawk8VnD5VD6UeH8KarQ/Z022zgjHDoHmlNiAewstXuuzXc0Hk5pGFSdG+nNw5bfJKXqj1ZXHn9yUA==}
'@formatjs/intl@4.1.14':
resolution: {integrity: sha512-hl8dgvbV2Te/KPnCud+nuBc+z8qW8fGreiun7ul5LopIHkbP0izylvnhIFDL2dQMeMPdrKCAXhJkYDeoxVuDRw==}
'@fortawesome/fontawesome-free@6.7.2': '@fortawesome/fontawesome-free@6.7.2':
resolution: {integrity: sha512-JUOtgFW6k9u4Y+xeIaEiLr3+cjoUPiAuLXoyKOJSia6Duzb7pq+A76P9ZdPDoAoxHdHzq6gE9/jKBGXlZT8FbA==} resolution: {integrity: sha512-JUOtgFW6k9u4Y+xeIaEiLr3+cjoUPiAuLXoyKOJSia6Duzb7pq+A76P9ZdPDoAoxHdHzq6gE9/jKBGXlZT8FbA==}
engines: {node: '>=6'} engines: {node: '>=6'}
@@ -3106,9 +3088,6 @@ packages:
resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
intl-messageformat@11.2.9:
resolution: {integrity: sha512-cGzymZerpDhVXRKjKLgXKda9gI29TU2o88L7gwNMHp3WZVxA/0c5tX52udXbW9JklDApolvMXZG6Dhhdz5eirA==}
is-array-buffer@3.0.5: is-array-buffer@3.0.5:
resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==} resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@@ -3973,12 +3952,6 @@ packages:
peerDependencies: peerDependencies:
react: ^19.2.0 react: ^19.2.0
react-intl@10.1.14:
resolution: {integrity: sha512-DuL7vAViDCjxyiPNccMkt1PBv22mh+1OBhA8ta4r0fbjnJYhLVFc+3pR71qADZRHytRnKm9JcVDP9jYJW+qO6g==}
peerDependencies:
'@types/react': '>=18.0.0'
react: '>=18.0.0'
react-is@16.13.1: react-is@16.13.1:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
@@ -4019,10 +3992,6 @@ packages:
react-dom: ^18.2.0 react-dom: ^18.2.0
typescript: ^5.0.0 typescript: ^5.0.0
react@19.2.0:
resolution: {integrity: sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==}
engines: {node: '>=0.10.0'}
read-binary-file-arch@1.0.6: read-binary-file-arch@1.0.6:
resolution: {integrity: sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg==} resolution: {integrity: sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg==}
hasBin: true hasBin: true
@@ -6045,20 +6014,6 @@ snapshots:
'@floating-ui/utils@0.2.10': {} '@floating-ui/utils@0.2.10': {}
'@formatjs/fast-memoize@3.1.6': {}
'@formatjs/icu-messageformat-parser@3.5.12':
dependencies:
'@formatjs/icu-skeleton-parser': 2.1.10
'@formatjs/icu-skeleton-parser@2.1.10': {}
'@formatjs/intl@4.1.14':
dependencies:
'@formatjs/fast-memoize': 3.1.6
'@formatjs/icu-messageformat-parser': 3.5.12
intl-messageformat: 11.2.9
'@fortawesome/fontawesome-free@6.7.2': {} '@fortawesome/fontawesome-free@6.7.2': {}
'@humanfs/core@0.19.1': {} '@humanfs/core@0.19.1': {}
@@ -6469,12 +6424,11 @@ snapshots:
picocolors: 1.1.1 picocolors: 1.1.1
redent: 3.0.0 redent: 3.0.0
'@testing-library/react@16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@19.2.2(@types/react@19.2.2))(@types/react@19.2.2)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)': '@testing-library/react@16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@19.2.2(@types/react@19.2.2))(@types/react@19.2.2)(react-dom@19.2.0)':
dependencies: dependencies:
'@babel/runtime': 7.28.4 '@babel/runtime': 7.28.4
'@testing-library/dom': 10.4.1 '@testing-library/dom': 10.4.1
react: 19.2.0 react-dom: 19.2.0
react-dom: 19.2.0(react@19.2.0)
optionalDependencies: optionalDependencies:
'@types/react': 19.2.2 '@types/react': 19.2.2
'@types/react-dom': 19.2.2(@types/react@19.2.2) '@types/react-dom': 19.2.2(@types/react@19.2.2)
@@ -6717,7 +6671,7 @@ snapshots:
'@codemirror/state': 6.6.0 '@codemirror/state': 6.6.0
'@codemirror/view': 6.41.0 '@codemirror/view': 6.41.0
'@uiw/react-codemirror@4.25.9(@babel/runtime@7.28.4)(@codemirror/autocomplete@6.20.1)(@codemirror/language@6.12.3)(@codemirror/lint@6.9.0)(@codemirror/search@6.5.11)(@codemirror/state@6.6.0)(@codemirror/theme-one-dark@6.1.3)(@codemirror/view@6.41.0)(codemirror@6.0.2)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)': '@uiw/react-codemirror@4.25.9(@babel/runtime@7.28.4)(@codemirror/autocomplete@6.20.1)(@codemirror/language@6.12.3)(@codemirror/lint@6.9.0)(@codemirror/search@6.5.11)(@codemirror/state@6.6.0)(@codemirror/theme-one-dark@6.1.3)(@codemirror/view@6.41.0)(codemirror@6.0.2)(react-dom@19.2.0)':
dependencies: dependencies:
'@babel/runtime': 7.28.4 '@babel/runtime': 7.28.4
'@codemirror/commands': 6.10.3 '@codemirror/commands': 6.10.3
@@ -6726,8 +6680,7 @@ snapshots:
'@codemirror/view': 6.41.0 '@codemirror/view': 6.41.0
'@uiw/codemirror-extensions-basic-setup': 4.25.9(@codemirror/autocomplete@6.20.1)(@codemirror/commands@6.10.3)(@codemirror/language@6.12.3)(@codemirror/lint@6.9.0)(@codemirror/search@6.5.11)(@codemirror/state@6.6.0)(@codemirror/view@6.41.0) '@uiw/codemirror-extensions-basic-setup': 4.25.9(@codemirror/autocomplete@6.20.1)(@codemirror/commands@6.10.3)(@codemirror/language@6.12.3)(@codemirror/lint@6.9.0)(@codemirror/search@6.5.11)(@codemirror/state@6.6.0)(@codemirror/view@6.41.0)
codemirror: 6.0.2 codemirror: 6.0.2
react: 19.2.0 react-dom: 19.2.0
react-dom: 19.2.0(react@19.2.0)
transitivePeerDependencies: transitivePeerDependencies:
- '@codemirror/autocomplete' - '@codemirror/autocomplete'
- '@codemirror/language' - '@codemirror/language'
@@ -8210,11 +8163,6 @@ snapshots:
hasown: 2.0.2 hasown: 2.0.2
side-channel: 1.1.0 side-channel: 1.1.0
intl-messageformat@11.2.9:
dependencies:
'@formatjs/fast-memoize': 3.1.6
'@formatjs/icu-messageformat-parser': 3.5.12
is-array-buffer@3.0.5: is-array-buffer@3.0.5:
dependencies: dependencies:
call-bind: 1.0.9 call-bind: 1.0.9
@@ -8579,9 +8527,7 @@ snapshots:
dependencies: dependencies:
yallist: 4.0.0 yallist: 4.0.0
lucide-react@0.546.0(react@19.2.0): lucide-react@0.546.0: {}
dependencies:
react: 19.2.0
lucide@0.546.0: {} lucide@0.546.0: {}
@@ -8991,58 +8937,42 @@ snapshots:
minimist: 1.2.8 minimist: 1.2.8
strip-json-comments: 2.0.1 strip-json-comments: 2.0.1
react-confetti@6.4.0(react@19.2.0): react-confetti@6.4.0:
dependencies: dependencies:
react: 19.2.0
tween-functions: 1.2.0 tween-functions: 1.2.0
react-dom@19.2.0(react@19.2.0): react-dom@19.2.0:
dependencies: dependencies:
react: 19.2.0
scheduler: 0.27.0 scheduler: 0.27.0
react-intl@10.1.14(@types/react@19.2.2)(react@19.2.0):
dependencies:
'@formatjs/icu-messageformat-parser': 3.5.12
'@formatjs/intl': 4.1.14
'@types/react': 19.2.2
intl-messageformat: 11.2.9
react: 19.2.0
react-is@16.13.1: {} react-is@16.13.1: {}
react-is@17.0.2: {} react-is@17.0.2: {}
react-refresh@0.17.0: {} react-refresh@0.17.0: {}
react-resizable-panels@3.0.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0): react-resizable-panels@3.0.6(react-dom@19.2.0):
dependencies: dependencies:
react: 19.2.0 react-dom: 19.2.0
react-dom: 19.2.0(react@19.2.0)
react-router-dom@7.9.4(react-dom@19.2.0(react@19.2.0))(react@19.2.0): react-router-dom@7.9.4(react-dom@19.2.0):
dependencies: dependencies:
react: 19.2.0 react-dom: 19.2.0
react-dom: 19.2.0(react@19.2.0) react-router: 7.9.4(react-dom@19.2.0)
react-router: 7.9.4(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
react-router@7.9.4(react-dom@19.2.0(react@19.2.0))(react@19.2.0): react-router@7.9.4(react-dom@19.2.0):
dependencies: dependencies:
cookie: 1.0.2 cookie: 1.0.2
react: 19.2.0
set-cookie-parser: 2.7.1 set-cookie-parser: 2.7.1
optionalDependencies: optionalDependencies:
react-dom: 19.2.0(react@19.2.0) react-dom: 19.2.0
react-shepherd@6.1.9(react-dom@19.2.0(react@19.2.0))(react@19.2.0)(typescript@5.9.3): react-shepherd@6.1.9(react-dom@19.2.0)(typescript@5.9.3):
dependencies: dependencies:
react: 19.2.0 react-dom: 19.2.0
react-dom: 19.2.0(react@19.2.0)
shepherd.js: 14.5.1 shepherd.js: 14.5.1
typescript: 5.9.3 typescript: 5.9.3
react@19.2.0: {}
read-binary-file-arch@1.0.6: read-binary-file-arch@1.0.6:
dependencies: dependencies:
debug: 4.4.3 debug: 4.4.3

View File

@@ -120,7 +120,8 @@ function AppRoutes() {
export default function App() { export default function App() {
const locale = 'ht'; const locale = 'ht';
const translatedMessages = getLocalizedMessages(locale); const translatedMessages = getLocalizedMessages(locale);
console.log(translatedMessages); // TODO: fazer botão
window.localStorage.setItem("locale", 'ht');
return ( return (
<Router> <Router>
<Suspense fallback={<LoadingFallback />}> <Suspense fallback={<LoadingFallback />}>

View File

@@ -42,7 +42,7 @@ export const gameConfig = {
// ========================================== // ==========================================
{ {
id: 1, id: 1,
nome: "Fase 1: A Linha Reta", nome: "$atividades.aspirador.nome",
descricao: "Use o bloco 'Enquanto houver sujeira' e o comando 'Mover' para ligá-lo.", descricao: "Use o bloco 'Enquanto houver sujeira' e o comando 'Mover' para ligá-lo.",
timeout: 10, timeout: 10,
maxBlocks: 3, maxBlocks: 3,

View File

@@ -1,6 +1,7 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { translate } from "../../services/localizedMessages";
function obterDificuldade(dadosFase) { function obterDificuldade(dadosFase) {
// Usa a dificuldade da fase, se existir, senão calcula pelo número // Usa a dificuldade da fase, se existir, senão calcula pelo número
@@ -40,7 +41,7 @@ function GameFaseInfo({ phaseData = {}, phaseNumber }) {
{/* Título/Subtítulo */} {/* Título/Subtítulo */}
<div className="flex-1 min-w-0 px-3 lg:px-5"> <div className="flex-1 min-w-0 px-3 lg:px-5">
<h3 className="text-base lg:text-2xl font-semibold text-gray-800 truncate"> <h3 className="text-base lg:text-2xl font-semibold text-gray-800 truncate">
{phaseData.nome} {translate(phaseData.nome)}
</h3> </h3>
{phaseData.descricao && ( {phaseData.descricao && (
<p className="text-base lg:text-lg text-gray-600 leading-tight whitespace-pre-wrap mt-1 pr-12 lg:pr-0"> <p className="text-base lg:text-lg text-gray-600 leading-tight whitespace-pre-wrap mt-1 pr-12 lg:pr-0">

View File

@@ -1,8 +1,29 @@
import ht from "./../../lang/ht.json"; import ht from "./../../lang/ht.json";
import pt from "./../../lang/pt.json"; import pt from "./../../lang/pt.json";
export function getLocalizedMessages(locale) { export function getLocalizedMessages(locale) {
console.log('localized import json');
return { return {
ht, ht,
pt pt
}; }[locale];
}
export function getUserLocale() {
return getLocalizedMessages(window.localStorage.getItem('locale') ?? 'pt');
}
const accessObject = (path, object) => {
return path.split('.').reduce((o, i) => o[i], object);
}
export function translate(message) {
if (message.match(/^\$/)) {
const result = accessObject(message.substr(1), getUserLocale());
if(result) {
return result;
} else {
console.error(`path ${message} not found on lang`);
}
}
return message;
} }