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

[Task-979] Remove submission counter and add organization name to header if MMO is enabled #5215

Merged
merged 8 commits into from
Oct 31, 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
10 changes: 3 additions & 7 deletions jsapp/js/components/header/mainHeader.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import GitRev from './gitRev.component';
import pageState from 'js/pageState.store';
import styles from './mainHeader.module.scss';
import Button from 'js/components/common/button';
import OrganizationBadge from 'js/components/header/organizationBadge.component';

interface MainHeaderProps extends WithRouterProps {
assetUid: string | null;
Expand Down Expand Up @@ -156,16 +157,11 @@ const MainHeader = class MainHeader extends React.Component<MainHeaderProps> {
)}

<HeaderTitleEditor asset={asset} isEditable={userCanEditAsset} />

{asset.has_deployment &&
asset.deployment__submission_count !== null && (
<bem.MainHeader__counter>
{asset.deployment__submission_count} {t('submissions')}
</bem.MainHeader__counter>
)}
</React.Fragment>
)}

<OrganizationBadge/>

<AccountMenu />

{!isLoggedIn && this.renderLoginButton()}
Expand Down
1 change: 0 additions & 1 deletion jsapp/js/components/header/mainHeaderBase.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import bem, {makeBem} from 'js/bem';
bem.MainHeader = makeBem(null, 'main-header', 'header');
bem.MainHeader__icon = makeBem(bem.MainHeader, 'icon');
bem.MainHeader__title = makeBem(bem.MainHeader, 'title');
bem.MainHeader__counter = makeBem(bem.MainHeader, 'counter');

interface MainHeaderBaseProps {
children: React.ReactNode;
Expand Down
17 changes: 17 additions & 0 deletions jsapp/js/components/header/organizationBadge.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {useOrganizationQuery} from 'jsapp/js/account/stripe.api';
import styles from './organizationBadge.module.scss';

export default function OrganizationBadge() {
// TODO: move this logic to the parent component when we refactor it
// into a functional component. OrganizationBadge should just be a
// purely presentational component.
const orgQuery = useOrganizationQuery();

if (orgQuery.data?.is_mmo) {
return (
<div className={styles.root}>{orgQuery.data.name.toUpperCase()}</div>
);
} else {
return null;
}
}
12 changes: 12 additions & 0 deletions jsapp/js/components/header/organizationBadge.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@use 'scss/colors';

.root {
color: colors.$kobo-white;
background-color: colors.$kobo-gray-700;
padding: 6px 10px;
border-radius: 48px;
font-weight: 600;
font-size: .85em;
line-height: 12px;
margin-right: 20px;
}
10 changes: 2 additions & 8 deletions jsapp/scss/components/_kobo.navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@

// On smaller screens we hide both of them
.main-header .main-header__icon,
.main-header .main-header__counter {
.main-header {
display: none;
}

Expand Down Expand Up @@ -303,12 +303,6 @@
}
}
}

.main-header__counter {
font-size: variables.$base-font-size;
margin-right: 20px;
color: colors.$kobo-gray-500;
}
}

.git-rev {
Expand All @@ -317,7 +311,7 @@

@include breakpoints.breakpoint(mediumAndUp) {
.main-header .main-header__icon,
.main-header .main-header__counter {
.main-header {
display: initial;
}

Expand Down
Loading