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

Notifications rewrite + small fixes #556

Merged
merged 11 commits into from
Nov 19, 2024
Merged

Conversation

patrick11514
Copy link
Contributor

  • Added ability for SuspensionWrapper to pass rest of props to child
  • Moved utilities.ts file to folder called utilities and renamed it to utils.ts to maintain some folder structure, that having everything in src folder
  • Added getDataWithCSRF, which just fills the header X-CSRFToken and then call getFromAPI. This is alternative to fetch function in api.js (also swapped order of parameters of getFromAPI from url, data, method, headers to url, method, data, headers, beacause we usually want to specify method first and then data (if any).
  • Ported Notifications and refactored code a little bit + fixed Notifications are not scrollable #455 by setting max height to 50vh, if exceeded, notifications list is scollable
  • Added ability to switch between old layout (currenly only Notificaions), with cookie newUI. If set (technically to any value), then new Vue components are used, when 0 or not presented, then old Svelte components are used. When notification will be tested in production, then we can just remove the svelte version and remove the condition in front of Vue version.

Copy link
Collaborator

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Looks great! Left a few nits, and style/lints need to be fixed.

I realized that there's a lot of duplicated code with Svelte now. Since the component seems to work well, let's just nuke the old Svelte code and notifications code, to avoid having two copies there.

But please still keep the newUI logic, we will use it in the future for more complicated components.

frontend/src/components/Loader.vue Outdated Show resolved Hide resolved
frontend/src/components/Notifications.vue Outdated Show resolved Hide resolved
frontend/src/components/Notifications.vue Outdated Show resolved Hide resolved
@Kobzol Kobzol mentioned this pull request Nov 18, 2024
@Kobzol
Copy link
Collaborator

Kobzol commented Nov 18, 2024

I will do some push notification fixed on top of this PR (#557) once this is merged.

@patrick11514
Copy link
Contributor Author

I realized that there's a lot of duplicated code with Svelte now. Since the component seems to work well, let's just nuke the old Svelte code and notifications code, to avoid having two copies there.

I just looked into svelte files, and we can only remove Notifications.svelte file, becuase notifications.js is also used here

@Kobzol
Copy link
Collaborator

Kobzol commented Nov 19, 2024

Just out of curiosity, is Svelte (+ our build system) unable to import code from .ts files? Or perhaps use the .js prefix when referring to TS files?

@patrick11514
Copy link
Contributor Author

Okay, so importing typescript files into svelte works, so I removed the old js and svelte file and changed the import in TaskDetails and also tested it.

Copy link
Collaborator

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Ok, awesome :) Thank you, this is great!

@Kobzol Kobzol merged commit 3e990d2 into mrlvsb:master Nov 19, 2024
2 checks passed
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.

Notifications are not scrollable
2 participants