Skip to content

Commit

Permalink
Regression: Favorite room button (#15426)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored and ggazzo committed Sep 23, 2019
1 parent 97856c3 commit 9251902
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
14 changes: 5 additions & 9 deletions app/theme/client/imports/components/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,7 @@

padding: 0 0.25rem;

color: var(--header-toggle-favorite-star-color);

&.empty {
color: var(--header-toggle-favorite-color);

& > .rc-header__icon {
fill: none;
}
}
color: var(--header-toggle-favorite-color);

& > .rc-header__icon {
font-size: 2rem;
Expand All @@ -265,6 +257,10 @@
&:hover {
color: var(--header-toggle-favorite-star-color);
}

&--checked {
color: var(--header-toggle-favorite-star-color);
}
}

&__toggle-encryption {
Expand Down
1 change: 0 additions & 1 deletion app/theme/client/imports/components/tooltip.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

bottom: 100%;

min-height: 100%;
margin: 11px 0;
padding: 0.5em 1em;

Expand Down
1 change: 1 addition & 0 deletions app/ui/client/components/header/header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Template } from 'meteor/templating';

import { TabBar, fireGlobalEvent } from '../../../../ui-utils';
import './header.html';

Template.header.helpers({
back() {
Expand Down
2 changes: 1 addition & 1 deletion app/ui/client/components/header/headerRoom.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

{{#if isToggleFavoriteButtonVisible}}
<div class="rc-header__block rc-header__favorite rc-header__block--action">
<button aria-label="{{toggleFavoriteButtonIconLabel}}" type="button" class="rc-header__toggle-favorite rc-header__first-icon js-favorite">
<button aria-label="{{toggleFavoriteButtonIconLabel}}" type="button" class="rc-header__toggle-favorite {{#if isToggleFavoriteButtonChecked}}rc-header__toggle-favorite--checked{{/if}} rc-header__first-icon rc-tooltip rc-tooltip--down rc-tooltip--start js-favorite">
{{> icon block="rc-header__icon" icon=toggleFavoriteButtonIcon}}
</button>
</div>
Expand Down
4 changes: 4 additions & 0 deletions app/ui/client/components/header/headerRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { emoji } from '../../../../emoji';
import { Markdown } from '../../../../markdown/client';
import { hasAllPermission } from '../../../../authorization';

import './headerRoom.html';

const getUserStatus = (id) => {
const roomData = Session.get(`roomData${ id }`);
return roomTypes.getUserStatus(roomData.t, id);
Expand All @@ -27,6 +29,7 @@ const getUserStatusText = (id) => {
Template.headerRoom.helpers({
isDiscussion: () => Template.instance().state.get('discussion'),
isToggleFavoriteButtonVisible: () => Template.instance().state.get('favorite') !== null,
isToggleFavoriteButtonChecked: () => Template.instance().state.get('favorite'),
toggleFavoriteButtonIconLabel: () => (Template.instance().state.get('favorite') ? t('Unfavorite') : t('Favorite')),
toggleFavoriteButtonIcon: () => (Template.instance().state.get('favorite') ? 'star-filled' : 'star'),

Expand Down Expand Up @@ -145,6 +148,7 @@ Template.headerRoom.events({
'click .js-favorite'(event, instance) {
event.stopPropagation();
event.preventDefault();
event.currentTarget.blur();

return Meteor.call(
'toggleFavorite',
Expand Down
2 changes: 0 additions & 2 deletions app/ui/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ import './components/popupList.html';
import './components/popupList';
import './components/selectDropdown.html';

import './components/header/header.html';
import './components/header/header';
import './components/header/headerRoom.html';
import './components/header/headerRoom';
import './components/contextualBar.html';
import './components/contextualBar';
Expand Down

0 comments on commit 9251902

Please sign in to comment.