-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Display dcl and ens worlds in worlds view (#2933)
* feat: Create hook to get currently selected tab * fix: Move types to another file * feat: Provide classnames to worlds storage * fix: Format * feat: Render dcl names or ens names view according to tab * fix: Rename functions * feat: Render size * feat: Fetch external names on render * fix: Tests * fix: Update tests * fix: Add tests for new util * feat: Fetch data on connect * fix: Add tests * fix: Format * fix: Fetch world deployments for external names when they are fetched successfuly * fix: Test * fix: Only show / 25 for ens names * feat: Saga returns ENS instead of just strings * feat: Fetch deployments and world status when external names are fetched * fix: Add test * fix: Remove unused function * fix: Make owner mandatory * fix: Make address mandatory * fix: Update src/modules/ens/utils.spec.ts Co-authored-by: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com> Signed-off-by: Fernando Zavalia <24811313+fzavalia@users.noreply.github.com> * fix: Remove unused function * fix: Use Mb instead of mb * fix: Add test --------- Signed-off-by: Fernando Zavalia <24811313+fzavalia@users.noreply.github.com> Co-authored-by: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com>
- Loading branch information
1 parent
1473bc9
commit 5aa57f9
Showing
31 changed files
with
467 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,3 +166,7 @@ | |
.WorldListPage .ui.dropdown { | ||
margin-right: 20px; | ||
} | ||
|
||
.WorldListPage .worlds-storage { | ||
margin-bottom: 24px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 35 additions & 3 deletions
38
src/components/WorldListPage_WorldsForEnsOwnersFeature/WorldsStorage/WorldsStorage.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,50 @@ | ||
import { render, screen } from '@testing-library/react' | ||
import WorldsStorage, { CURRENT_MBS_TEST_ID, PROGRESS_TEST_ID } from './WorldsStorage' | ||
import WorldsStorage, { CURRENT_MBS_TEST_ID, PROGRESS_TEST_ID, WORLDS_STORAGE_TEST_ID } from './WorldsStorage' | ||
|
||
describe('when rendering the worlds storage component', () => { | ||
let currentBytes: number | ||
let maxBytes: number | ||
let className: string | ||
|
||
beforeEach(() => { | ||
currentBytes = 100 | ||
maxBytes = 100 | ||
}) | ||
|
||
describe('when the provided current bytes is 50550000 and the max bytes is 100000000', () => { | ||
beforeEach(() => { | ||
render(<WorldsStorage currentBytes={50550000} maxBytes={100000000} />) | ||
currentBytes = 50550000 | ||
maxBytes = 100000000 | ||
|
||
render(<WorldsStorage currentBytes={currentBytes} maxBytes={maxBytes} />) | ||
}) | ||
|
||
it('should render 50.55/100.00mb', () => { | ||
expect(screen.getByTestId(CURRENT_MBS_TEST_ID).textContent).toEqual('50.55 / 100.00 mb') | ||
expect(screen.getByTestId(CURRENT_MBS_TEST_ID).textContent).toEqual('50.55 / 100.00 Mb') | ||
}) | ||
|
||
it('should render the storage front bar with 50%', () => { | ||
expect(screen.getByTestId(PROGRESS_TEST_ID).children[0].getAttribute('style')).toEqual('width: 50%;') | ||
}) | ||
}) | ||
|
||
describe('when providing a classname as prop', () => { | ||
beforeEach(() => { | ||
className = 'some-class' | ||
render(<WorldsStorage currentBytes={currentBytes} maxBytes={maxBytes} className={className} />) | ||
}) | ||
it('should set the classname to the root element', () => { | ||
expect(screen.getByTestId(WORLDS_STORAGE_TEST_ID).className).toEqual(`worldsStorage ${className}`) | ||
}) | ||
}) | ||
|
||
describe('when a classname is not provided', () => { | ||
beforeEach(() => { | ||
render(<WorldsStorage currentBytes={currentBytes} maxBytes={maxBytes} />) | ||
}) | ||
|
||
it('should set the classname to the root element', () => { | ||
expect(screen.getByTestId(WORLDS_STORAGE_TEST_ID).className).toEqual('worldsStorage') | ||
}) | ||
}) | ||
}) |
13 changes: 8 additions & 5 deletions
13
src/components/WorldListPage_WorldsForEnsOwnersFeature/WorldsStorage/WorldsStorage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/components/WorldListPage_WorldsForEnsOwnersFeature/WorldsStorage/WorldsStorage.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export type Props = { | ||
maxBytes: number | ||
currentBytes: number | ||
className?: string | ||
} |
3 changes: 3 additions & 0 deletions
3
src/components/WorldListPage_WorldsForEnsOwnersFeature/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const fromBytesToMegabytes = (bytes: number) => { | ||
return bytes / 1000000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
5aa57f9
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.
Successfully deployed to the following URLs:
builder – ./
builder-git-master-decentraland1.vercel.app
builder-decentraland1.vercel.app