Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User preferences localstorage #123

Closed
wants to merge 11 commits into from
Closed

Conversation

MaxiLein
Copy link
Contributor

@MaxiLein MaxiLein commented Oct 19, 2023

Summary

Details

  • Multi delete, delete key, row delete are working as intended
  • The User-Preferences are now accessible and changeable via the useUserPreferences hook.
    • preferences is an object with, as of for now, value-type of: string | number | boolean.
    • the default preferences settings, as well as their type can be adjusted if needed ( src/management-system-v2/lib/user-preferences.ts )
    • addPreferences will overwrite a preferences if already existent or add a new one if not - preferences that are already set but not included in addPreferences will remain

Current default values:
{
'show-process-meta-data': true,
'icon-view-in-process-list': false,
};

Usage:

import { useUserPreferences } from '@/lib/user-preferences';

const { preferences, addPreferences } = useUserPreferences();

// ...
{ preferences['some-preference'] && 
<div
    onClick={
            () => { addPreference( {'some-preferences': !preferences['some-preference'] } ) 
        } 
    }
>
    Some-Preference
</div>}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be part of this repo

@@ -42,7 +42,7 @@
flex: auto;
position: relative;
/* Need this for the absolute editor page to work in non-parallel route. */
min-height: 100vh;
height: 92vh;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this value come from?

Comment on lines +88 to +114

// <List
// /* Force rerender when layout changes */
// key={layout.xxl}
// className="Hide-Scroll-Bar"
// style={{
// flex: 3,
// }}
// grid={
// /* column: 4 */
// layout
// }
// dataSource={data}
// renderItem={(item) => (
// <List.Item>
// {
// <TabCard
// item={item}
// completeList={data!}
// selection={selection}
// setSelection={setSelection}
// tabcard={false}
// />
// }
// </List.Item>
// )}
// />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be in this repo

@@ -7,6 +7,7 @@ import React, {
Key,
Dispatch,
SetStateAction,
use,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidental addition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make a prefs zustand store Use LocalStorage instead of cookies for browser state
3 participants