Skip to content

Commit

Permalink
more ui/ux updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas099X committed Jan 7, 2025
1 parent 9b363c5 commit e696ede
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 43 deletions.
14 changes: 6 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def menu_button(session):

# Define menu items as links
home_button = A(Div(cls="ti ti-home text-2xl"), "Home", href="/", cls="btn btn-wide btn-primary btn-rounded btn-outline rounded-lg m-1.5")
practice_button = A(Div(cls="ti ti-highlight text-2xl"), "Practice", href="/practice/explore", cls="btn btn-wide btn-primary btn-rounded btn-outline rounded-lg m-1.5")
practice_button = A(Div(cls="ti ti-highlight text-2xl"), "Practice", href="/practice/explore", cls="btn btn-primary btn-rounded btn-outline rounded-lg m-1.5")
explore_button = A(Div(cls="ti ti-compass text-2xl"), "Explore", href="/explore", cls="btn btn-wide btn-primary btn-outline btn-rounded rounded-lg m-1.5")
tutors_button = A(Div(cls="ti ti-bookmarks text-2xl"), "Tutors", href="/tutors", cls="btn btn-wide btn-primary btn-outline btn-rounded rounded-lg m-1.5")
report_button = A(Div(cls="ti ti-exclamation-circle text-2xl text-neutral"), "Issue Report", href="https://tally.so/r/312ovO", cls="btn btn-wide btn-error btn-rounded rounded-lg m-1.5")
github_button = A(Div(cls="ti ti-brand-github text-2xl text-neutral"), "Github", href="https://github.com/Anas099X/OpenSAT", cls="btn btn-wide btn-ghost btn-rounded rounded-lg m-1.5")
tutors_button = A(Div(cls="ti ti-bookmarks text-2xl"), "Tutors", href="/tutors", cls="btn btn-primary btn-outline btn-rounded rounded-lg m-1.5")
report_button = A(Div(cls="ti ti-exclamation-circle text-2xl text-neutral"), "Issue Report", href="https://tally.so/r/312ovO", cls="btn btn-error btn-rounded rounded-lg m-1.5")
github_button = A(Div(cls="ti ti-brand-github text-2xl"), "Github", href="https://github.com/Anas099X/OpenSAT", cls="btn bg-blue-700 btn-outline btn-rounded rounded-lg m-1.5")

# Drawer structure
return Div(
Expand Down Expand Up @@ -90,9 +90,7 @@ def menu_button(session):
practice_button,
explore_button,
tutors_button,
report_button,
github_button,
cls="menu bg-base-200 rounded-lg text-base-content mt-4 max-w-2xl"
cls="menu pink rounded-lg text-base-content mt-4 max-w-2xl"
),
cls="p-4"
),
Expand Down Expand Up @@ -160,7 +158,7 @@ def get(session):
),
cls="hero-content flex-col lg:flex-row items-center"
),
cls="hero pink min-h-screen mb-0"
cls="hero rounded-3xl pink min-h-screen mb-0"
)

third_hero = Div(
Expand Down
12 changes: 7 additions & 5 deletions routes/explore.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def generate_question_list_view():
A(
Div(
Div( # Icon section
Div(cls="ti ti-books text-4xl text-primary"), # Example icon, adjust as needed
Div(cls="ti ti-books text-4xl text-gray-700"), # Example icon, adjust as needed
cls="flex-shrink-0 p-2"
),
Div( # Content section
H2(f"Question #{i + 1}", cls="font-bold text-lg"), # Question title
H2(f"Question #{i + 1}", cls="font-bold text-lg text-gray-700"), # Question title
P(x["domain"], cls="text-sm text-gray-500"), # Domain or category
Div( # Metadata (e.g., stats)
Div(f"Difficulty: {x.get('difficulty', 'N/A')}", cls="text-xs text-gray-400"),
Expand Down Expand Up @@ -93,13 +93,15 @@ def generate_question_list_view():
cls="sticky top-0 bg-gray-800 z-50"
),
Main(
H1("Explore", cls="text-4xl font-extrabold text-center my-8 text-gray-700"),
Div(

Div(
Div(
H1(
Div(cls="ti ti-filter text-4xl text-neutral"),
Div(cls="ti ti-filter text-4xl text-gray-700"),
"Filters",
cls="text-2xl font-bold mb-4"
cls="text-2xl font-bold mb-4 text-gray-700"
),
# Section Filters with Labels
Div(
Expand All @@ -109,7 +111,7 @@ def generate_question_list_view():
Div(cls="ti ti-a-b-2 text-2xl"),
"English",
href=f"?{urlencode({'section': 'english', 'domain': 'any'})}",
cls=f"btn btn-primary btn-rounded btn-outline btn-sm {'btn-active' if section == 'english' else ''}"
cls=f"btn btn-primary text-gray-700 btn-rounded btn-outline btn-sm {'btn-active' if section == 'english' else ''}"
),
A(
Div(cls="ti ti-math-symbols text-2xl"),
Expand Down
14 changes: 7 additions & 7 deletions routes/practice.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def get(session):
*[
Div(
A(
Div(Div(cls="ti ti-highlight text-4xl text-neutral"), cls="text-3xl"), # Icon for each module
H2(module['name'], cls="card-title text-xl font-bold mt-1"), # Module name
P("Practice Test", cls="text-primary font-bold"),
cls="card bg-base-200 shadow-xl w-96 mx-auto hover:bg-base-300 transition-all rounded-lg p-8",
Div(Div(cls="ti ti-highlight text-4xl text-gray-700"), cls="text-3xl"), # Icon for each module
H2(module['name'], cls="card-title text-xl font-bold mt-1 text-gray-700"), # Module name
P("Practice Test", cls="text-gray-700 font-bold"),
cls="card bg-base-200 shadow-xl w-96 mx-auto hover:bg-gray-300 transition-all rounded-lg p-8",
href=f"/practice/{i}/module/1"
)
)
Expand All @@ -55,7 +55,7 @@ def get(session):
),
cls="container mx-auto py-8"
)
), data_theme="lofi",cls="bg-base-200"
), data_theme="lofi",cls="pink"
)
)

Expand Down Expand Up @@ -224,7 +224,7 @@ def practice_options(value: str):
),
id="practice_html"
),
data_theme="lofi",cls="bg-base-200" # lofi theme enabled
data_theme="lofi",cls="pink" # lofi theme enabled
)
)

Expand Down Expand Up @@ -363,7 +363,7 @@ def answer_collecter(module_num):
),
cls="flex items-center justify-center min-h-screen"
),
data_theme="lofi",cls="bg-base-200"
data_theme="lofi",cls="pink"
)
)

Expand Down
71 changes: 48 additions & 23 deletions routes/tutors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from fasthtml.common import *
from main import *


@rt("/tutors")
def get(session):
firestore_docs = db.collection('users').stream()
Expand Down Expand Up @@ -30,32 +29,58 @@ def get(session):
),
Main(
Div(
H1("Meet Your Tutors", cls="text-4xl font-extrabold text-center my-8 text-gray-700"),
P("Browse through a list of available tutors and find the perfect match for your learning needs.",
cls="text-center text-gray-500 mb-8 text-lg"),
# Tutor cards in grid format
*[Div(
Div(
*[
Div(
# Avatar (Image) and Card Body
Div(
H2(Div(Img(src=doc.to_dict()['banner'],cls="rounded-full"),cls="bg-neutral text-neutral-content w-12 rounded-full"),doc.to_dict()['username'], cls="card-title"),
P(doc.to_dict()['description'], cls="text-sm text-gray-500"),
P(f"Availability: {doc.to_dict()['availability']}", cls="text-sm text-gray-500"),
P(f"Email: {doc.to_dict()['email']}", cls="text-sm text-gray-500"),
P(f"Country: {doc.to_dict()['country']}", cls="text-sm text-gray-500"),
cls="card-body"
),
# Card Actions with Button
Div(
A(f"Contact: {doc.to_dict()['contact']}", href=f"mailto:{doc.to_dict()['email']}", cls="btn btn-primary"),
cls="card-actions justify-end"
# Card Header: Image and Name
Div(
Div(
Img(src=doc.to_dict()['banner'], cls="w-20 h-20 rounded-full shadow-lg mx-auto"),
cls="text-center"
),
H3(doc.to_dict()['username'], cls="text-2xl font-bold text-gray-800 mt-4 text-center"),
cls="mb-4"
),
# Card Body: Description and Details
Div(
P(doc.to_dict()['description'],
cls="text-gray-600 text-center text-base mb-4"),
Div(
P(f"🕒 Availability: {doc.to_dict()['availability']}",
cls="text-base text-gray-700 font-medium"),
P(f"🌍 Country: {doc.to_dict()['country']}",
cls="text-base text-gray-700 font-medium"),
cls="mb-4 text-center"
),
cls="flex-1" # Ensures even height
),
# Contact Button
Div(
A(
"Contact Tutor",
href=f"mailto:{doc.to_dict()['email']}",
cls="btn btn-outline btn-primary w-full"
),
cls="mt-4"
),
cls="card bg-gray-50 shadow-md rounded-lg p-6 flex flex-col justify-between transition hover:bg-gray-100 hover:shadow-lg h-full"
),
cls="card bg-base-200 w-96 shadow-xl p-2"
),
cls="max-w-sm mx-auto"
) for doc in firestore_docs],
cls="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6"
cls="w-full max-w-xs mx-auto"
) for doc in firestore_docs
],
cls="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 px-6"
),
cls="container mx-auto py-8"
),
cls="container mx-auto py-6"
)
), data_theme="lofi",cls="bg-base-200"
cls="pink"
),
cls="pink w-full"
),
data_theme="lofi", cls="pink w-full"
)
)

0 comments on commit e696ede

Please sign in to comment.