Refactor VersionHistory component to use dynamic username from localStorage for version tracking
This commit is contained in:
parent
8ef37039f0
commit
b623bff6dd
|
@ -9,17 +9,17 @@ import {
|
||||||
import RenameInput from "../../../ui/inputs/RenameInput";
|
import RenameInput from "../../../ui/inputs/RenameInput";
|
||||||
|
|
||||||
const VersionHistory = () => {
|
const VersionHistory = () => {
|
||||||
|
const userName = localStorage.getItem("userName") ?? "Anonymous";
|
||||||
const initialVersions = [
|
const initialVersions = [
|
||||||
{
|
{
|
||||||
versionName: "v1.0",
|
versionName: "v1.0",
|
||||||
timestamp: "April 09, 2025",
|
timestamp: "April 09, 2025",
|
||||||
savedBy: "Nanni",
|
savedBy: userName,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const [versions, setVersions] = useState(initialVersions);
|
const [versions, setVersions] = useState(initialVersions);
|
||||||
const [selectedVersion, setSelectedVersion] = useState(initialVersions[0]);
|
const [selectedVersion, setSelectedVersion] = useState(initialVersions[0]);
|
||||||
const userName = localStorage.getItem("userName") ?? "Anonymous";
|
|
||||||
|
|
||||||
const addNewVersion = () => {
|
const addNewVersion = () => {
|
||||||
const newVersionNumber = versions.length + 1;
|
const newVersionNumber = versions.length + 1;
|
||||||
|
|
Loading…
Reference in New Issue