-
-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Ts migration #756
Open
lit26
wants to merge
10
commits into
pastelsky:bundlephobia
Choose a base branch
from
lit26:ts-migration
base: bundlephobia
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ts migration #756
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ce601c0
Add migration
lit26 7e4b966
Add similar packages section migration
lit26 577d1c5
Add treemapsection migrations
lit26 4615e85
Add more migration
lit26 f0f072d
Add more migrations
lit26 66c771a
Add migrations
lit26 707acff
Merge branch 'pastelsky:bundlephobia' into ts-migration
lit26 a0be457
Add more types
lit26 4550b59
Merge branch 'ts-migration' of github-lit:lit26/bundlephobia into ts-…
lit26 7adb615
Merge branch 'bundlephobia' into ts-migration
lit26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion
9
...PackagesSection/SimilarPackagesSection.js → ...ackagesSection/SimilarPackagesSection.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
File renamed without changes.
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 |
---|---|---|
|
@@ -2,8 +2,15 @@ import React, { Component } from 'react' | |
import { formatSize } from 'utils' | ||
import colors from 'client/config/colors' | ||
import { Treemap, TreemapSquare } from 'client/components/Treemap' | ||
import { DependencySize } from '../../../../types' | ||
|
||
class TreemapSection extends Component { | ||
type TreemapSectionProps = { | ||
packageName: string | ||
packageSize: number | ||
dependencySizes: DependencySize[] | ||
} | ||
|
||
class TreemapSection extends Component<TreemapSectionProps> { | ||
state = { | ||
width: 0, | ||
height: 0, | ||
|
@@ -77,7 +84,7 @@ class TreemapSection extends Component { | |
})) | ||
|
||
depdendenciesCopy.sort((depA, depB) => { | ||
return depB.percentShare - depA.percentShare | ||
return (depB.percentShare || 0) - (depA.percentShare || 0) | ||
}) | ||
|
||
let compactedDependencies = [] | ||
|
@@ -93,11 +100,11 @@ class TreemapSection extends Component { | |
0 | ||
) | ||
const percentShare = otherDependencies.reduce( | ||
(acc, dep) => acc + dep.percentShare, | ||
(acc, dep) => acc + (dep.percentShare || 0), | ||
0 | ||
) | ||
const sizeShare = otherDependencies.reduce( | ||
(acc, dep) => acc + dep.sizeShare, | ||
(acc, dep) => acc + (dep.sizeShare || 0), | ||
0 | ||
) | ||
|
||
|
@@ -110,7 +117,7 @@ class TreemapSection extends Component { | |
tooltip: otherDependencies | ||
.map( | ||
dep => | ||
`${dep.name} | ${dep.percentShare.toFixed( | ||
`${dep.name} | ${(dep.percentShare || 0).toFixed( | ||
1 | ||
)}% | ~ ${getFormattedSize(dep.sizeShare)} min` | ||
) | ||
|
@@ -136,8 +143,9 @@ class TreemapSection extends Component { | |
data-balloon-pos="top" | ||
className="treemap__square" | ||
> | ||
{dep.percentShare > ellipsizeLimit && | ||
dep.name.length < dep.percentShare * (12 / ellipsizeLimit) ? ( | ||
{(dep.percentShare || 0) > ellipsizeLimit && | ||
dep.name.length < | ||
(dep.percentShare || 0) * (12 / ellipsizeLimit) ? ( | ||
<div className="treemap__content"> | ||
<div className="treemap__label"> | ||
{dep.isSelf || dep.isOthers ? ( | ||
|
@@ -156,11 +164,11 @@ class TreemapSection extends Component { | |
className="treemap__percent" | ||
style={{ | ||
fontSize: `${ | ||
14 + Math.min(dep.percentShare * 1.2, 25) | ||
14 + Math.min((dep.percentShare || 0) * 1.2, 25) | ||
}px`, | ||
}} | ||
> | ||
{dep.percentShare.toFixed(1)} | ||
{(dep.percentShare || 0).toFixed(1)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks rather verbose. We should ensure that if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So how do you want to handle this? |
||
<span className="treemap__percent-sign">%</span> | ||
</div> | ||
</div> | ||
|
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 did we need to comment this out?
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 think the child component does not use
path