✨ Add TabsBar to the LayoutBig (Conversations layout)
This commit is contained in:
@@ -143,10 +143,54 @@ fn LayoutSmall() -> Element {
|
|||||||
|
|
||||||
{conversation_panels.iter()}
|
{conversation_panels.iter()}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
fn Tab(room_id: RoomId) -> Element {
|
||||||
|
let rooms = STORE.read().rooms();
|
||||||
|
let room = rooms.get(&room_id).unwrap().signal();
|
||||||
|
|
||||||
|
let room_avatar = if let Some(content) = room.avatar() {
|
||||||
|
let encoded = general_purpose::STANDARD.encode(content);
|
||||||
|
rsx! {
|
||||||
div {
|
div {
|
||||||
class: ClassName::CONVERSATIONS_VIEW_TAIL,
|
class: ClassName::TAB_AVATAR_IMAGE,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::TAB_AVATAR_IMAGE,
|
||||||
|
background_image: format!("url(data:image/jpeg;base64,{encoded})"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
VNode::empty()
|
||||||
|
};
|
||||||
|
|
||||||
|
rsx! {
|
||||||
|
div {
|
||||||
|
class: ClassName::TAB,
|
||||||
|
|
||||||
|
{room_avatar}
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::TAB_NAME,
|
||||||
|
|
||||||
|
{room.name()}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
fn TabsBar(room_ids: HashSet<RoomId>) -> Element {
|
||||||
|
let tabs = room_ids
|
||||||
|
.iter()
|
||||||
|
.map(|room_id| rsx! { Tab { room_id: room_id.clone() }});
|
||||||
|
|
||||||
|
rsx! {
|
||||||
|
div {
|
||||||
|
class: ClassName::TABS_BAR,
|
||||||
|
|
||||||
|
{tabs}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +261,11 @@ fn LayoutBig() -> Element {
|
|||||||
div {
|
div {
|
||||||
class: ClassName::CONVERSATIONS_VIEW_BIG_CONVERSATIONS,
|
class: ClassName::CONVERSATIONS_VIEW_BIG_CONVERSATIONS,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::CONVERSATIONS_VIEW_BIG_CONVERSATIONS_TABS_BAR,
|
||||||
|
|
||||||
|
TabsBar { room_ids: displayed_room_ids}
|
||||||
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
class: ClassName::CONVERSATIONS_VIEW_BIG_CONVERSATIONS_PANELS,
|
class: ClassName::CONVERSATIONS_VIEW_BIG_CONVERSATIONS_PANELS,
|
||||||
|
@@ -125,9 +125,6 @@ $inner-panel-height-ratio: 0.95;
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
|
|
||||||
// overflow: scroll;
|
|
||||||
// scrollbar-width: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__panels {
|
&__panels {
|
||||||
@@ -155,3 +152,64 @@ $inner-panel-height-ratio: 0.95;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tabs-bar {
|
||||||
|
$gap: min(1vw, 8px);
|
||||||
|
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
gap: $gap;
|
||||||
|
overflow: scroll;
|
||||||
|
|
||||||
|
scrollbar-width: none;
|
||||||
|
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab {
|
||||||
|
$gap: min(1vw, 8px);
|
||||||
|
|
||||||
|
height: 100%;
|
||||||
|
min-width: 0px;
|
||||||
|
max-width: 100%;
|
||||||
|
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: $gap;
|
||||||
|
|
||||||
|
border: $border-normal;
|
||||||
|
border-color: get-color(primary, 90);
|
||||||
|
border-radius: $border-radius;
|
||||||
|
|
||||||
|
padding: calc($gap / 2) $gap;
|
||||||
|
|
||||||
|
font-size: 2vh;
|
||||||
|
|
||||||
|
background-color: get-color(greyscale, 0);
|
||||||
|
|
||||||
|
&__avatar-image {
|
||||||
|
height: 100%;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
|
||||||
|
border: $border-thin;
|
||||||
|
border-color: get-color(greyscale, 90);
|
||||||
|
border-radius: $border-radius;
|
||||||
|
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__name {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0px;
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
cursor: default3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user