-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR! 🍃
So what do you do for the homepage? Is it using the old version? I don't remember.
I confused this PR with the builder's one, so maybe some comments are irrelevant but let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work, I think it still need some refactor. Try to add more comments as well because it takes some time to understand why you're doing some things ☃️
src/utils/item.ts
Outdated
if (data.length === 1) { | ||
tree[data[0].id] = { ...data[0], children: [] }; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need a special case for 1? Won't it work with the normal process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically, we build our tree based on parent-children relation which will not work for a non-children Item, As we build a map tree based on parent
src/utils/item.ts
Outdated
const keys = Object.keys(mapTree); | ||
const allChildren: string[] = keys.reduce((acc: string[], key: string) => { | ||
const node = mapTree[key as keyof Tree]; | ||
if (node && node.children) { | ||
acc.push(...node.children); | ||
} | ||
return acc; | ||
}, []); | ||
const rootKeys = keys.filter((key) => !allChildren.includes(key)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to find the rootKeys? I think for a normal player view you only have one root. Can't you define it in the arguments? Let's not take into account the home view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to get the first parent, this is the only way to get it even it's only one root
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some issues:
There is a random "show more" when I open any item.
There is a unwanted "flickering" when:
- You click on a folder A. It expands as expected.
- You click on another folder B. It expands as expected.
- You click on A again, the folder folds. I think we should avoid this folding.
My previous way of solving that was to only deal with expanding/folding using the arrow but no one liked it.
Do you think it's possible to do something like: - click on folder A show and expands A.
- click on folder B shows and expands B.
- click on folder A again does not folds it but show it's content.
- clicking on the arrow of A folds/expands it but does not show the content.
src/utils/item.ts
Outdated
if (data.length === 1) { | ||
tree[data[0].id] = { ...data[0], children: [] }; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this?
23695f9
to
86c74e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I proposed some changes in my commit to improve typings and also support the file mimetype icons.
I also tries to understand why the WS test was failing, see my explanation in the review. I add it here for visibility
The unexpected error that you get when you run these tests locally is due to vite using Websockets for hot module replacement (HMR).
In this test we stub the Websockets, so when vite tries to use them, it fails. The easiest way to get around this and keep the test is to not use the development server for this test, but to use a staticaly built version of the website served by a basic webserver.
I.e.: Do not launch the player for the interactive tests with yarn start:test but use the build + preview commands: yarn build --mode test && yarn preview --port 3333 the port should match what cypress expects.
This means you will not be able to change the source code interactively for these tests, but at least they will not fail because of stupid Websockets mocking issues. Hope it helps !
I removed unnecessary waits in tests.
cypress/e2e/ws.cy.ts
Outdated
@@ -8,6 +8,8 @@ import { | |||
import { FOLDER_WITH_SUBFOLDER_ITEM } from '../fixtures/items'; | |||
import { expectFolderButtonLayout } from '../support/integrationUtils'; | |||
|
|||
Cypress.on('uncaught:exception', () => false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pyphilia @LinaYahya
The unexpected error that you get when you run these tests locally is due to vite using Websockets for hot module replacement (HMR).
In this test we stub the Websockets, so when vite tries to use them, it fails. The easiest way to get around this and keep the test is to not use the development server for this test, but to use a staticaly built version of the website served by a basic webserver.
I.e.: Do not launch the player for the interactive tests with yarn start:test
but use the build + preview commands: yarn build --mode test && yarn preview --port 3333
the port should match what cypress expects.
This means you will not be able to change the source code interactively for these tests, but at least they will not fail because of stupid Websockets mocking issues. Hope it helps !
cypress/support/integrationUtils.ts
Outdated
cy.wait(100); | ||
menu.click(); | ||
menu.get(`#${MAIN_MENU_ID}`).contains(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clicking on the container is useless and results in not what is expected (opens the child that happens to be under it). I guess this was changed by @pyhpilia, maybe before the children were closed and clicking on the main menu was the only way to open it. Anyway in that case the chosen cypress selector should not have been MAIN_MENU
as it will always be found (even when there is no data). Instead target something that is only present once data has been loaded (for example a selector with the item id of the root element).
90f4714
to
c85f83f
Compare
c85f83f
to
e3f47e7
Compare
closes #413