Skip to content
Snippets Groups Projects
Commit c631797a authored by Tom Robinson's avatar Tom Robinson
Browse files

Section name. Move label button

parent 8d9669e6
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,10 @@ const Item = ({ id, name, created, by, selected, favorite, archived, icon, label
</div>
<ItemBody id={id} name={name} labels={labels} created={created} by={by} />
<div className={S.rightIcons}>
<LabelPopover
triggerElement={<Icon className={S.tagIcon} name="grid" width={20} height={20} />}
item={{ id, labels }}
/>
<Icon className={S.favoriteIcon} name="star" width={20} height={20} onClick={() => setFavorited(id, !favorite) }/>
</div>
<div className={S.extraIcons}>
......@@ -38,10 +42,6 @@ const ItemBody = pure(({ id, name, labels, created, by }) =>
<div className={S.itemTitle}>
<span className={S.itemName}>{name}</span>
<Labels labels={labels} />
<LabelPopover
triggerElement={<Icon className={S.tagIcon} name="grid" />}
item={{ id, labels }}
/>
</div>
<div className={S.itemSubtitle}>
{"Created "}
......
import { createSelector } from 'reselect';
import moment from "moment";
import _ from "underscore";
import visualizations from "metabase/visualizations";
......@@ -91,10 +92,6 @@ export const getAllAreSelected = createSelector(
selectedCount === visibleCount && visibleCount > 0
)
// FIXME:
export const getSectionName = (state, props) =>
sections[0].name;
const sections = [
{ id: "all", name: "All questions", icon: "star" },
{ id: "favorites", name: "Favorites", icon: "star" },
......@@ -106,11 +103,13 @@ const sections = [
export const getSections = (state) => sections;
export const getTopics = (state) => [];
export const getEditingLabelId = (state) => state.labels.editing;
export const getLabels = createSelector(
[(state) => state.labels.entities.labels, (state) => state.labels.labels],
(labelEntities, labelIds) =>
labelIds.map(id => labelEntities[id])
)
);
const getLabelCountsForSelectedEntities = createSelector(
[getSelectedEntities],
......@@ -123,7 +122,7 @@ const getLabelCountsForSelectedEntities = createSelector(
}
return counts;
}
)
);
export const getLabelsWithSelectedState = createSelector(
[getLabels, getSelectedCount, getLabelCountsForSelectedEntities],
......@@ -138,4 +137,15 @@ export const getLabelsWithSelectedState = createSelector(
}))
)
export const getEditingLabelId = (state) => state.labels.editing;
export const getSectionName = createSelector(
[getSection, getSlug, getSections, getLabels],
(sectionId, slug, sections, labels) => {
if (sectionId === "label") {
let label = _.findWhere(labels, { slug: slug });
return label && label.name
} else {
let section = _.findWhere(sections, { id: sectionId });
return section && section.name
}
}
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment