Web:Client:Home: update logic for render tags for tile view

This commit is contained in:
TimofeyBoyko 2022-11-09 14:35:04 +03:00
parent 9290603b4b
commit 5dc3376f85

View File

@ -492,6 +492,35 @@ class Tile extends React.PureComponent {
? t("Translations:TitleShowFolderActions") ? t("Translations:TitleShowFolderActions")
: t("Translations:TitleShowActions"); : t("Translations:TitleShowActions");
const tags = [];
if (item.providerType) {
tags.push({
isThirdParty: true,
icon: item.thirdPartyIcon,
label: item.providerKey,
onClick: () =>
selectOption({
option: "typeProvider",
value: item.providerType,
}),
});
}
if (item?.tags?.length > 0) {
tags.push(...item.tags);
} else {
tags.push({
isDefault: true,
label: t(RoomsTypeTranslations[item.roomType]),
onClick: () =>
selectOption({
option: "defaultTypeRoom",
value: item.roomType,
}),
});
}
return ( return (
<StyledTile <StyledTile
ref={this.tile} ref={this.tile}
@ -572,37 +601,37 @@ class Tile extends React.PureComponent {
</StyledOptionButton> </StyledOptionButton>
</div> </div>
<div className="room-tile_bottom-content"> <div className="room-tile_bottom-content">
{item.providerType && ( <Tags
<Tag columnCount={columnCount}
icon={item.thirdPartyIcon} onSelectTag={selectTag}
label={item.providerKey} tags={tags}
onClick={() => />
selectOption({ {/* {item.providerType && (
option: "typeProvider", <Tag
value: item.providerType, icon={item.thirdPartyIcon}
}) label={item.providerKey}
} onClick={() =>
/> selectOption({
)} option: "typeProvider",
value: item.providerType,
})
}
/>
)} */}
{/* {item.tags.length > 0 ? ( */}
{item.tags.length > 0 ? ( {/* ) : (
<Tags <Tag
columnCount={columnCount} isDefault
onSelectTag={selectTag} label={t(RoomsTypeTranslations[item.roomType])}
tags={item.tags} onClick={() =>
/> selectOption({
) : ( option: "defaultTypeRoom",
<Tag value: item.roomType,
isDefault })
label={t(RoomsTypeTranslations[item.roomType])} }
onClick={() => />
selectOption({ )} */}
option: "defaultTypeRoom",
value: item.roomType,
})
}
/>
)}
</div> </div>
</> </>
) : ( ) : (