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

feat(demo): Add portal version selection dropdown #567

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

MarkoOleksiyenko
Copy link
Contributor

No description provided.

const versionsParsed: Version[] = [{folder: 'latest', version: 'Latest'}];

onMount(() => {
fetch('https://amadeusitgroup.github.io/AgnosUI/versions.json').then((res) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

was thinking to add the pathToRoot/versions.json but it won't work on local (kinda useless but still interesting to have). WDYT?

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.20%. Comparing base (5547e27) to head (e17549f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #567      +/-   ##
==========================================
+ Coverage   90.02%   90.20%   +0.17%     
==========================================
  Files         111      111              
  Lines        3931     3931              
  Branches      729      787      +58     
==========================================
+ Hits         3539     3546       +7     
+ Misses        390      383       -7     
  Partials        2        2              
Flag Coverage Δ
e2e-1 54.54% <ø> (ø)
e2e-2 68.27% <ø> (-0.21%) ⬇️
e2e-3 68.41% <ø> (-0.28%) ⬇️
e2e-4 86.95% <ø> (ø)
e2e-6 87.14% <ø> (ø)
e2e-7 54.54% <ø> (-6.46%) ⬇️
e2e-8 88.06% <ø> (ø)
e2e-9 78.63% <ø> (ø)
unit 87.81% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MarkoOleksiyenko MarkoOleksiyenko linked an issue Mar 7, 2024 that may be closed by this pull request
@quentinderoubaix
Copy link
Contributor

Instead of building the versions in the onMount of the Versions component, you could do like this:

+layout.ts

export const prerender = true;

export const load = async () => {
    const versionFetch = await fetch('https://amadeusitgroup.github.io/AgnosUI/versions.json');
    const versions = [{folder: 'main', version: 'PREVIEW'}].concat(await versionFetch.json());
    versions[1].folder === 'latest';
    return {
        versions
    };
}

+layout.svelte

<script>
   export let data;
</script>
...
<Versions versions={data.versions} />

Versions.svelte

<script>
  interface Version {
    folder: string;
    version: string;
  }
  export let versions: Version[];
</script>

demo/src/lib/components-metadata.ts Outdated Show resolved Hide resolved
demo/src/routes/menu/Versions.svelte Outdated Show resolved Hide resolved
demo/src/routes/menu/Versions.svelte Outdated Show resolved Hide resolved
demo/src/routes/menu/Versions.svelte Outdated Show resolved Hide resolved
<div class="nav-item ms-3">
<div class="dropdown">
<button
class="btn nav-link dropdown-toggle align-items-center d-flex"
Copy link
Contributor

Choose a reason for hiding this comment

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

If you add the PREVIEW, targetting main, it could be good to change the styling of the button to make it clear to users it's not released yet.
Maybe something like this ?

<button
  class="btn nav-link dropdown-toggle align-items-center d-flex {$currentVersion$.version === 'PREVIEW' ? 'badge text-bg-warning' : ''}"
 ></button>

@MarkoOleksiyenko MarkoOleksiyenko force-pushed the demo-version branch 5 times, most recently from 898c661 to 44d6eb0 Compare March 12, 2024 14:57
Copy link
Contributor

@quentinderoubaix quentinderoubaix left a comment

Choose a reason for hiding this comment

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

LGTM !

@quentinderoubaix quentinderoubaix merged commit 8ca86f6 into AmadeusITGroup:main Mar 12, 2024
13 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.

Drop down version to select the AgnosUI doc version displayed
2 participants