Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
afcirillo96 committed Nov 20, 2024
2 parents 4a1e72d + 1ce8462 commit e2a85ed
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 7 deletions.
91 changes: 91 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@jsonforms/material-renderers": "^3.3.0",
"@jsonforms/react": "^3.3.0",
"@reduxjs/toolkit": "^2.2.7",
"axios": "^1.7.7",
"next": "14.2.4",
"react": "^18",
"react-dom": "^18",
Expand Down
39 changes: 39 additions & 0 deletions src/app/components/LatestRelease.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { useEffect, useState } from "react";
import axios from "axios";

function LatestRelease() {
const [latestRelease, setLatestRelease] = useState(null);
const [error, setError] = useState(null);

useEffect(() => {
async function fetchLatestRelease() {
try {
const response = await axios.get(
"https://api.github.com/repos/ign-argentina/argenmap-editor/releases/latest"
);
setLatestRelease(response.data);
} catch (error) {
setError("Error obteniendo la última release");
console.error(error);
}
}

fetchLatestRelease();
}, []); // El array vacío asegura que solo se ejecuta al montar el componente.

if (error) {
return <div>{error}</div>;
}

if (!latestRelease) {
return <div>Cargando...</div>;
}

return (
<div>
<h1>{latestRelease.tag_name}</h1>
</div>
);
}

export default LatestRelease;
13 changes: 9 additions & 4 deletions src/app/components/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import LatestRelease from "../components/LatestRelease";

const Navbar = ({ config, language, selectedLang, handleLanguageChange, handleClearStorage, sectionKeys, selectedSection, handleSectionChange, setIsFormShown, isFormShown, handleDownload, handleJsonUpload }) => {
const handleFileChange = (event) => {
Expand All @@ -18,10 +19,11 @@ const Navbar = ({ config, language, selectedLang, handleLanguageChange, handleCl
<div className="logo-container">
<img src="/logos/logo2.png" alt="Logo" className="logo" />
</div>
<div className="version-info">
<label>EDITOR v0.0.0</label>
<div className="configVersion-info">
<label>
{config?.configVersion ? `Usando config v${config.configVersion}` : "Config sin versión"}
</label>
</div>

<label className="navbar-button">
<input
type="file"
Expand All @@ -31,7 +33,7 @@ const Navbar = ({ config, language, selectedLang, handleLanguageChange, handleCl
title="Subir JSON"
/>
<i className="fa-solid fa-upload" style={{ cursor: "pointer" }}></i>

Subir JSON
</label>

Expand Down Expand Up @@ -80,6 +82,9 @@ const Navbar = ({ config, language, selectedLang, handleLanguageChange, handleCl
</span>
Descargar
</button>
<div className="version-info">
<LatestRelease />
</div>
</div>
);
};
Expand Down
12 changes: 9 additions & 3 deletions src/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,14 @@ input[type='number']::-webkit-outer-spin-button {
}

.version-info {
font-size: 16px;
font-weight: bold;
font-size: 14px;
color: var(--text--color);
font-weight: lighter;
}

.configVersion-info {
font-size: 13px;
font-weight: inherit;
color: var(--text--color);
}

Expand Down Expand Up @@ -210,7 +216,7 @@ input[type='number']::-webkit-outer-spin-button {
align-items: center;
height: 50px;
width: 100%;
margin-bottom: 15px;
margin-bottom: 5px;
font-size: 16px;
transition: background-color 0.3s;
text-align: left;
Expand Down

0 comments on commit e2a85ed

Please sign in to comment.