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

LocalStorage, Copy&Paste, Modals, Scrollbar, Highlight #135

Merged
merged 24 commits into from
Nov 8, 2023

Conversation

MaxiLein
Copy link
Contributor

Summary

Details

User-Preferences:

  • The User-Preferences are now accessible and changeable via the useUserPreferences hook.
    • preferences is an object with, as of for now, value-type of: any.
    • 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:

const defaultPreferences: PreferencesType = {
  /* Default User-Settings: */
  /* 
    Delete user-preferences in localstorage, after adding a preference-setting
    The new default won't be set otherwise
  */
  'show-process-meta-data': true,
  'icon-view-in-process-list': false,
  'process-list-columns': ['', 'Process Name', 'Description', 'Last Edited'],
  'ask-before-deleting-multiple': true,
  'ask-before-deleting-single': true,
  'ask-before-copying': true,
  'process-copy-modal-accordion': true,
};

Usage:

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

const { preferences, addPreferences } = useUserPreferences();

/* For better readability I suggest to use renaming for all the preferences you wish to use */
const {'ask-before-copying': renamePref} = preferences

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

Copy & Paste and Delete:

  • Users can delete processes via the buttons or via del
    • depending whether the user is deleting on or multiple processes a modal will pop up
    • failed deletes (multiple) can be retried
  • Users can copy and paste processes via ctrl-c + ctrl-v
    • the row copy button does not work yet (tbd)
    • A model opens and lets the user edit name and description before creating a copy

All modals can be set to not open and proceed with defaults via a checkbox by the user (userpreference).

Scrollbar:

  • Browsers have different scrollbars and different scrollbar properties making it hard to have unique looking scrollbars independant of the user's browser
    • Adding the css-class Hide-Scroll-Bar will remove all browser set scrollbars
/* Hide scrollbar for IE, Edge and Firefox */
.Hide-Scroll-Bar {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
/* Hide scrollbar for Chrome, Safari and Opera */
.Hide-Scroll-Bar::-webkit-scrollbar {
  display: none;
}
- For a vertical scroll I added the ScrollBar-Component
    - It's rendered accordingly to the scroll of its child
    - The scrollbar is draggable

Usage:

import ScrollBar from '@components/scrollbar';

// ...


      <div style={{width: '100px', height: '100px'}}> {/* The element wrapped around the Scrollbar should determine the dimensions */}
        <ScrollBar width='10px'> {/* The Scrollbar does add the `Hide-Scroll-Bar` class */}
          <div>
            Scrollable Content
          </div>
        </ScrollBar>
      </div>

Highlighting:

  • Added highlighting for the process-list (icon/list-view)
  • The highlighting is currently case sensitive

grafik


Adressing comments

Since this pull request includes the changes of #123 and #125 I will address their comments here:

MaxiLein and others added 21 commits October 5, 2023 18:10
src/management-system-v2/components/process-copy.tsx Outdated Show resolved Hide resolved
src/management-system-v2/components/process-copy.tsx Outdated Show resolved Hide resolved
src/management-system-v2/components/process-copy.tsx Outdated Show resolved Hide resolved
src/management-system-v2/components/process-copy.tsx Outdated Show resolved Hide resolved
src/management-system-v2/components/process-list.tsx Outdated Show resolved Hide resolved
src/management-system-v2/components/scrollbar.tsx Outdated Show resolved Hide resolved
@MaxiLein MaxiLein requested a review from FelipeTrost November 2, 2023 13:08
@FelipeTrost FelipeTrost merged commit d757317 into main Nov 8, 2023
10 checks passed
@FelipeTrost FelipeTrost deleted the delete-copy-process-modal branch November 8, 2023 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants