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

refactor: create useDirty composable #573

Open
Sekhmet opened this issue Aug 1, 2024 · 0 comments
Open

refactor: create useDirty composable #573

Sekhmet opened this issue Aug 1, 2024 · 0 comments

Comments

@Sekhmet
Copy link
Member

Sekhmet commented Aug 1, 2024

Currently we handle dirty flag, but it's not ideal (when loading already populated form it won't trigger because value has to be modified manually, we could solve this via use of composable and apply it across the app:

import { ModelRef } from 'vue';

type Definition<T> = {
  default?: T;
};

export function useDirty<T>(model: ModelRef<T>, definition: Definition<T>) {
  const modelModified = ref(false);

  const dirty = computed(() => {
    if (modelModified.value) return true;
    if (definition.default && model.value !== definition.default) return true;
    return !!model.value;
  });

  watch(model, () => {
    modelModified.value = true;
  });

  return {
    dirty,
    modelModified
  };
}
Sekhmet added a commit that referenced this issue Aug 27, 2024
Sekhmet added a commit that referenced this issue Aug 28, 2024
Sekhmet added a commit that referenced this issue Aug 28, 2024
#653)

* fix: ceil scrollLeft

For some reason scrollBy might not scroll all the way (for example 199.5 instead of 200).
Further calls won't cause another scroll so we might be missing 0.5 to the right.

This changes it so if we are off by less than 1 pixel we still treat it as scrolled
all the way to the right.

* feat: move profile settings to Settings

* fix: block form on formErrors

* fix: make navigation sticky

* chore: update settings tab layout

* fix: clear formErrors on reset

* fix: truncate treasury and delegation names

* feat: make sure elements scroll into view on focus

* feat: make gradient step more visible on xxl

* fix: use v-show for profile tab to retain dirty flags

More general solution is needed: #573

* fix: update paddings

* fix: scroll to end

This somehow prevents vertical scroll that causes profile page to scroll
away.

* fix: assure padding on small screens

* fix: increase sticky menu z-index to 50
Sekhmet added a commit that referenced this issue Sep 23, 2024
Sekhmet added a commit that referenced this issue Sep 24, 2024
* feat: add parent and sub-space settings

* feat: add terms of services input

* feat: add customDomain and isPrivate

* feat: add DeleteSpace UI

* feat: add support for deleteSpace action

* feat: validate parent space

* feat: add tooltips

* fix: handle initial value validation

* fix: validate parent or sub-space is not current space

* fix: prevent duplicate sub-spaces

* chore: fix typo actions -> action

* fix: increase checkbox label gap

* fix: use v2 external link icon

* fix: remove danger border if button is disabled

* chore: capitalize GitHub name

* fix: add default values for computedAsync

* feat: use inline validation

* feat: allow parent and subspaces at the same time

* feat: remove description from Advanced settings page

* feat: inline Message icon

* fix: show errors on customDomain field

* feat: add custom message for self-parent

* fix: use v-show for advanced

To workaround #573

* feat: add basic domain validation

* feat: add error when reaching maxmimum number of subspaces

* fix: only show child limit error if it's not empty
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

No branches or pull requests

1 participant