Created update button for workspace settings -- these include TIMEZONE and WORKSPACE NAME

This commit is contained in:
NPS Agent
2026-05-12 09:42:03 +09:30
parent 62d431818a
commit 60a1cf1b67
8 changed files with 112 additions and 14 deletions
+17 -6
View File
@@ -10,7 +10,7 @@ const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
const ACCENTS = ['#2A6FDB', '#1F8A5B', '#D97757', '#7A5AF8'];
function useApiData(authed) {
const [data, setData] = React.useState({ tasks: [], users: [], audit: [] });
const [data, setData] = React.useState({ tasks: [], users: [], audit: [], workspace: null });
const [loading, setLoading] = React.useState(true);
React.useEffect(() => {
@@ -19,13 +19,14 @@ function useApiData(authed) {
let mounted = true;
const load = async () => {
try {
const [tasks, users, audit] = await Promise.all([
const [tasks, users, audit, workspace] = await Promise.all([
api.getTasks(),
api.getUsers(),
api.getAudit()
api.getAudit(),
api.getWorkspace()
]);
if (mounted) {
setData({ tasks, users, audit });
setData({ tasks, users, audit, workspace });
setLoading(false);
}
} catch (e) {
@@ -55,7 +56,7 @@ function App() {
return 'rod';
});
const { tasks, users: dbUsers, audit, loading } = useApiData(authed);
const { tasks, users: dbUsers, audit, workspace, loading } = useApiData(authed);
const [tab, setTab] = React.useState('overview');
React.useEffect(() => {
@@ -76,7 +77,7 @@ function App() {
]);
if (!authed) {
return <LoginScreen dbUsers={dbUsers} onLogin={async (id, pwd) => {
return <LoginScreen dbUsers={dbUsers} workspace={workspace} onLogin={async (id, pwd) => {
await api.login(id, pwd);
setMeId(id);
setAuthed(true);
@@ -211,6 +212,7 @@ function App() {
onAdd={() => setAdding(meId)}
onLogs={() => setShowLogs(true)}
onProfile={() => setShowSettings(true)}
workspace={workspace}
/>
<HeadsUp items={headsUp} onDismiss={dismissHU} onOpenTask={openTaskFromAnywhere} />
@@ -308,6 +310,15 @@ function App() {
await api.changePassword(meId, oldPwd, newPwd);
await api.addAudit({ actor: meId, action: 'password_changed', summary: 'Updated password', target: meId });
}}
workspace={workspace}
onUpdateWorkspace={async (edits) => {
try {
await api.updateWorkspace(edits);
await api.addAudit({ actor: meId, action: 'workspace_updated', summary: 'Updated workspace settings', target: null });
} catch(e) {
alert("Failed to update workspace: " + e.message);
}
}}
/>
)}