Skip to content

Commit

Permalink
fix: Responsiveness (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
242816 authored Nov 25, 2024
1 parent 48bc8ff commit 5483d00
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 14 deletions.
1 change: 1 addition & 0 deletions crates/db/seed-data/assistants.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- db < crates/db/seed-data/assistants.sql
-- First, delete any existing prompts with type 'Assistant'
DELETE FROM prompts WHERE prompt_type = 'Assistant';

Expand Down
3 changes: 1 addition & 2 deletions crates/web-assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ document.addEventListener('turbo:frame-load', (event: Event) => {
if (sidebar) {
// On mobile screens
if (window.innerWidth < 1024) { // Tailwind's lg breakpoint is 1024px
console.log("here")
sidebar.classList.toggle('-translate-x-full');
sidebar.classList.add('-translate-x-full');
}
}
});
Expand Down
19 changes: 18 additions & 1 deletion crates/web-pages/base_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,24 @@ pub fn BaseLayout(props: AppLayoutProps) -> Element {
class: "flex h-screen overflow-hidden",
nav {
id: "sidebar",
class: "fixed inset-y-0 left-0 w-64 bg-gray-200 transform -translate-x-full transition-transform duration-200 ease-in-out flex flex-col lg:translate-x-0 lg:static lg:inset-auto lg:transform-none z-20",
class: "
fixed
inset-y-0
left-0
w-64
bg-gray-200
transform
-translate-x-full
transition-transform
duration-200
ease-in-out
flex
flex-col
lg:translate-x-0
lg:static
lg:inset-auto
lg:transform-none
z-20",
div {
class: "flex items-center p-4",
{props.sidebar_header}
Expand Down
2 changes: 1 addition & 1 deletion crates/web-pages/console/console_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn ConsoleStream(
chunks: chat_with_chunks.chunks.clone()
}
div {
class: "flex flex-col-reverse min-w-[65ch] max-w-prose mx-auto",
class: "flex flex-col-reverse pl-2 pr-2 md:pr-0 md:pl-0 md:min-w-[65ch] max-w-prose mx-auto",
TimeLine {
if let Some(response) = &chat_with_chunks.chat.response {
// We are generating text
Expand Down
2 changes: 1 addition & 1 deletion crates/web-pages/console/empty_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn EmptyStream(prompt: SinglePrompt, conversation_id: Option<i64>, team_id:
"What can I help with?"
}
div {
class: "flex flex-nowrap max-w-3xl flex-wrap items-stretch justify-center gap-4",
class: "grid grid-cols-2 md:grid-cols-4 pl-2 pr-2 max-w-3xl flex-wrap items-stretch justify-center gap-4",
for example in examples {
if let Some(example) = example {
if ! example.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion crates/web-pages/console/prompt_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn Form(
) -> Element {
rsx! {
div {
class: "mx-auto md:max-w-3xl lg:max-w-[40rem] xl:max-w-[48rem]",
class: "mx-auto pl-2 pr-2 md:max-w-3xl lg:max-w-[40rem] xl:max-w-[48rem]",

form {
class: "flex items-center gap-2 remember w-full bg-base-200 p-2 rounded-lg",
Expand Down
26 changes: 21 additions & 5 deletions crates/web-pages/models/model_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,24 @@ pub fn ModelTable(models: Vec<ModelWithPrompt>, team_id: i32) -> Element {
class: "table table-sm",
thead {
th { "Name" }
th { "Base URL" }
th {
class: "hidden md:block",
"Base URL"
}
th { "Model Type" }
th { "TPM Limit" }
th { "RPM Limit" }
th { "Context Length" }

th {
class: "hidden md:block",
"TPM Limit"
}
th {
class: "hidden md:block",
"RPM Limit"
}
th {
class: "hidden md:block",
"Context Length"
}
th {
class: "text-right",
"Action"
Expand All @@ -36,7 +49,7 @@ pub fn ModelTable(models: Vec<ModelWithPrompt>, team_id: i32) -> Element {
}
td {
code {
class: "[overflow-wrap:anywhere]",
class: "hidden md:block [overflow-wrap:anywhere]",
"{model.base_url}"
}
}
Expand All @@ -46,12 +59,15 @@ pub fn ModelTable(models: Vec<ModelWithPrompt>, team_id: i32) -> Element {
}
}
td {
class: "hidden md:block",
"{model.tpm_limit}"
}
td {
class: "hidden md:block",
"{model.rpm_limit}"
}
td {
class: "hidden md:block",
"{model.context_size}"
}
td {
Expand Down
7 changes: 6 additions & 1 deletion crates/web-pages/prompts/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ pub fn Page(
rbac: rbac.clone(),
title: "Assistants",
header: rsx!(
h3 { "Assistants" }
h3 {
span {
class: "hidden lg:block",
"Assistants"
}
}
div {
a {
href: crate::routes::prompts::MyPrompts{team_id}.to_string(),
Expand Down
12 changes: 10 additions & 2 deletions crates/web-pages/prompts/my_prompts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ pub fn Page(
rbac: rbac.clone(),
title: "My Assistants",
header: rsx!(
h3 { "My Assistants" }
h3 {
span {
class: "hidden md:block",
"My Assistants"
}
}
div {
a {
href: crate::routes::prompts::Index{team_id}.to_string(),
Expand Down Expand Up @@ -58,6 +63,7 @@ pub fn Page(
class: "table table-sm table-layout-fixed",
thead {
th {
class: "hidden md:block",
"Last Updated"
}
th {
Expand All @@ -69,6 +75,7 @@ pub fn Page(
"Edit"
}
th {
class: "hidden md:block",
class: "text-right",
"Action"
}
Expand All @@ -77,6 +84,7 @@ pub fn Page(
for prompt in &prompts {
tr {
td {
class: "hidden md:block",
RelativeTime {
format: RelativeTimeFormat::Relative,
datetime: "{prompt.updated_at}"
Expand All @@ -101,7 +109,7 @@ pub fn Page(

}
td {
class: "text-right",
class: "text-right hidden md:block",
DropDown {
direction: Direction::Left,
button_text: "...",
Expand Down

0 comments on commit 5483d00

Please sign in to comment.