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

Add candidate to preview URL #208

Merged
merged 7 commits into from
May 29, 2024

Conversation

ilyatitovich
Copy link
Contributor

Fixes #201

  • Added candidate in add route and logic to create backRoute for add route
  • Added logic to use router for setting and show candidate in core/preview.ts
  • Added candidate in URl in web/stores/router.ts
  • Updated web client to use links instead of buttons for set candidate and Back button in mobile navbar
  • Added tests

I would like to discuss this. Maybe we can improve the code and logic.

Checklist

  • Don’t rush. Check all changes in PR again.
  • Run pnpm test.
  • Think about changing documentation.
    • If you added a script to scripts/, add a comment with a description.
    • If you added a new folder, add its description to the project’s README.md.
    • If you added config, describe how we use this tool in the config’s comment.
    • If you added something to the project’s architecture, describe it in the project’s README.md.
    • Try to focus on “why?”, not “how?”.
  • If you added a new dependency, check our requirements.
  • Think about testing
    • If you added a feature, add unit tests.
    • If you added a new state to the UI, add visual tests.
    • If you fixed the bug, think about preventing bug regression in the future.
  • If you changed web client:
    • Think about moving code to core/. What code will also be useful on other platforms?
    • Run pnpm size and check the difference in the JS bundle size. Is it relevant to the changes? Change the limit in web/.size-limit.json if necessary.
    • The UI was checked in Chrome and Firefox (and Safari or Epiphany if you have them).
    • Think about keyboard UX. Is it easy to use the new feature with only one hand on a keyboard? Is it easy to understand what keys to press?
    • Think about HTML semantics.
    • Think about accessibility. Check a11y recommendations. Think about how screen reader users will use the tool. Is it easy to use on a screen with bad contrast?
    • Think about translations.
    • Think about right-to-left languages. What parts of the screen should be mirrored for Arabic or Hebrew languages?
  • If you changed web/main/ files:
    • Do you need to backport styles changes to web/public/404.html or web/public/500.html?
    • Think about app loading styles inlined in index.html.
  • If you changed core/:
    • Think about making types more precise. Can you better explain data relations by type?
    • Think about conflict resolution. We don’t need some very smart changing merging; just 2 changes of the same item on different clients should not break the database. What if the user changes an item on one machine and removes it on another?
    • Think about log and storage migration.
  • If you changed English translations:
    • Change translation ID if you change the meaning of the text.

core/preview.ts Outdated Show resolved Hide resolved
@ilyatitovich
Copy link
Contributor Author

Changed 'title' to 'url' for candidate.

@ai
Copy link
Contributor

ai commented May 20, 2024

Try to reload page when some candidate is selected, you will get 404 (you can use staging or call pnpm production in web/).

But everything works without candidate in URL.

We use this script to generate web/routes.regexp and then we are injecting it into nginx config.

@ilyatitovich
Copy link
Contributor Author

Updated pathRouter for handling page reload and avoiding 404 page.

@ai
Copy link
Contributor

ai commented May 21, 2024

Updated pathRouter for handling page reload and avoiding 404 page.

But when I press Reload, the candidate valuer changes.

  1. Open Add
  2. Enter github.blog
  3. Slow Reader will find 2 feeds: Comments for … and GitHub Blog. The Comments are selected by default.
  4. Click on GitHub Blog
  5. Reload the page.
  6. The comments are selected, not the GitHub Blog.

And during the refresh I see how ?candidate= is removed and set again.

@ilyatitovich
Copy link
Contributor Author

I think this happens because when we reload the page, setPreviewUrl() and other processes are ran. Maybe it’s worth providing a cache for the current candidate, for example, in localStore? We can update it when user type the different URL and clear when user moved to another route from add route.

@ai
Copy link
Contributor

ai commented May 22, 2024

Maybe it’s worth providing a cache for the current candidate, for example, in localStore

No, user can open multiple tabs with different URL.

The better is to change setPreviewURL() logic. For instance, we can not to auto-set candidate if there is something different in router.

@ilyatitovich
Copy link
Contributor Author

Changed logic for auto showing candidate on wide screen.

@ai ai merged commit 73d165d into hplush:main May 29, 2024
3 checks passed
@ai
Copy link
Contributor

ai commented May 29, 2024

Thanks! It was much more complex task that we thought in the beginning.

@ilyatitovich ilyatitovich deleted the core/add-candidate-to-preview-url branch May 29, 2024 09:02
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.

Add candidate to preview URL
2 participants