-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Custom Reports typescript updates and small functional changes #2046
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6e694ce
work
carkom 66764db
notes
carkom b4e1bff
error fixes
carkom e686011
updates
carkom ab9b611
card fix
carkom ebead44
fix filters
carkom 81457aa
Merge branch 'master' into renameReportVariables
carkom 6ce78b0
Merge remote-tracking branch 'upstream/master' into renameReportVaria…
carkom add33fc
fixes
carkom 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
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
39 changes: 39 additions & 0 deletions
39
packages/desktop-client/src/components/reports/ModeButton.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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React, { type MouseEventHandler, type ReactNode } from 'react'; | ||
|
||
import { type CSSProperties, theme } from '../../style'; | ||
import Button from '../common/Button'; | ||
|
||
type ModeButtonProps = { | ||
selected: boolean; | ||
children: ReactNode; | ||
style: CSSProperties; | ||
onSelect: MouseEventHandler<HTMLButtonElement>; | ||
}; | ||
|
||
function ModeButton({ selected, children, style, onSelect }: ModeButtonProps) { | ||
return ( | ||
<Button | ||
type="bare" | ||
style={{ | ||
padding: '5px 10px', | ||
backgroundColor: theme.menuBackground, | ||
marginRight: 5, | ||
fontSize: 'inherit', | ||
...(selected && { | ||
backgroundColor: theme.buttonPrimaryBackground, | ||
color: theme.buttonPrimaryText, | ||
':hover': { | ||
backgroundColor: theme.buttonPrimaryBackgroundHover, | ||
color: theme.buttonPrimaryTextHover, | ||
}, | ||
}), | ||
...style, | ||
}} | ||
onClick={onSelect} | ||
> | ||
{children} | ||
</Button> | ||
); | ||
} | ||
|
||
export default ModeButton; |
70 changes: 70 additions & 0 deletions
70
packages/desktop-client/src/components/reports/ReportLegend.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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React from 'react'; | ||
|
||
import { theme, styles } from '../../style'; | ||
import Text from '../common/Text'; | ||
import View from '../common/View'; | ||
|
||
type ReportLegendProps = { | ||
legend: Array<{ name: string; color: string }>; | ||
groupBy: string; | ||
}; | ||
|
||
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. Same here (no code changes). Pulled it out of reportSummary to separate as it's own element and added typescript. |
||
function ReportLegend({ legend, groupBy }: ReportLegendProps) { | ||
return ( | ||
<View | ||
style={{ | ||
backgroundColor: theme.pageBackground, | ||
alignItems: 'center', | ||
flex: 1, | ||
overflowY: 'auto', | ||
}} | ||
> | ||
<Text | ||
style={{ | ||
...styles.largeText, | ||
alignItems: 'center', | ||
marginBottom: 2, | ||
fontWeight: 400, | ||
paddingTop: 10, | ||
}} | ||
> | ||
{groupBy} | ||
</Text> | ||
<View> | ||
{legend.map(item => { | ||
return ( | ||
<View | ||
key={item.name} | ||
style={{ | ||
padding: 10, | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<View | ||
style={{ | ||
marginRight: 5, | ||
borderRadius: 1000, | ||
width: 14, | ||
height: 14, | ||
backgroundColor: item.color, | ||
}} | ||
/> | ||
<Text | ||
style={{ | ||
whiteSpace: 'nowrap', | ||
textOverflow: 'ellipsis', | ||
flexShrink: 0, | ||
}} | ||
> | ||
{item.name} | ||
</Text> | ||
</View> | ||
); | ||
})} | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
export default ReportLegend; |
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.
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.
code for this is the same (no changes). Pulled out of "reportSidebar" and added typescript