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

opencost: Fix the Details View Header Action #71

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions opencost/src/__snapshots__/details.stories.storyshot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`Storyshots OpencostDetails Loading State 1`] = `
class="MuiBox-root css-j1fy4m"
>
<div
id="cost"
id="opencost-plugin-cost-section"
>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-spacing-xs-2 makeStyles-sectionHeader makeStyles-sectionHeader css-6ejd34-MuiGrid-root"
Expand Down Expand Up @@ -125,7 +125,7 @@ exports[`Storyshots OpencostDetails No Data 1`] = `
class="MuiBox-root css-j1fy4m"
>
<div
id="cost"
id="opencost-plugin-cost-section"
>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-spacing-xs-2 makeStyles-sectionHeader makeStyles-sectionHeader css-6ejd34-MuiGrid-root"
Expand Down Expand Up @@ -309,7 +309,7 @@ exports[`Storyshots OpencostDetails Not Installed 1`] = `
class="MuiBox-root css-j1fy4m"
>
<div
id="cost"
id="opencost-plugin-cost-section"
>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-spacing-xs-2 makeStyles-sectionHeader makeStyles-sectionHeader css-6ejd34-MuiGrid-root"
Expand Down Expand Up @@ -388,7 +388,7 @@ exports[`Storyshots OpencostDetails Week Data 1`] = `
class="MuiBox-root css-j1fy4m"
>
<div
id="cost"
id="opencost-plugin-cost-section"
>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-spacing-xs-2 makeStyles-sectionHeader makeStyles-sectionHeader css-6ejd34-MuiGrid-root"
Expand Down
2 changes: 1 addition & 1 deletion opencost/src/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export function OpencostDetailSectionPure(props: OpencostDetailSectionPureProps)
<Grid spacing={2}>
<SectionBox
title={
<div id="cost">
<div id="opencost-plugin-cost-section">
<SectionHeader
title="Cost"
actions={[
Expand Down
10 changes: 9 additions & 1 deletion opencost/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ import { Settings } from './settings';
import { getConfigStore, getDisplayCurrency, getDisplayTimespan, getServiceDetails } from './utils';

function IconAction() {
const handleClick = event => {
event.preventDefault();
const targetElement = document.getElementById('opencost-plugin-cost-section');
if (targetElement) {
targetElement.scrollIntoView({ behavior: 'auto' });
}
};

return (
<Tooltip title={'Cost'}>
<IconButton href="#cost" aria-label={'Cost'} aria-haspopup="true">
<IconButton onClick={handleClick} aria-label={'Cost'} aria-haspopup="true">
<Icon icon="mdi:cash-register" />
</IconButton>
</Tooltip>
Expand Down
Loading