Skip to content

Commit 36e8145

Browse files
authored
fixes to the company dashboard template (#81)
Co-authored-by: pourhakimi <[email protected]>
1 parent 5a0cbde commit 36e8145

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

company_dashboard/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.db
2+
*.py[cod]
3+
.states
4+
assets/external/
5+
.web
6+
__pycache__/

company_dashboard/company_dashboard/company_dashboard.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def index() -> rx.Component:
2424
documents_table_section(),
2525
class_name="p-6 space-y-6",
2626
),
27-
class_name="ml-64 w-full h-[100vh] overflow-y-auto",
27+
class_name="w-full h-[100vh] overflow-y-auto",
2828
),
29-
class_name="flex bg-gray-50 h-[100vh] w-full overflow-hidden",
29+
class_name="flex flex-row bg-gray-50 h-[100vh] w-full overflow-hidden",
3030
on_mount=DashboardState.load_initial_data,
3131
)
3232

company_dashboard/company_dashboard/components/documents_table.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def documents_table_section() -> rx.Component:
6868
document_tab_button("Past Performance", 3),
6969
document_tab_button("Key Personnel", 2),
7070
document_tab_button("Focus Documents"),
71-
class_name="flex items-center space-x-2 border-b border-gray-200 pb-2 mb-4",
71+
class_name="flex flex-row flex-wrap items-center gap-2 justify-start pb-2",
7272
),
7373
rx.el.div(
7474
rx.el.button(
@@ -93,7 +93,7 @@ def documents_table_section() -> rx.Component:
9393
),
9494
class_name="flex items-center space-x-3",
9595
),
96-
class_name="flex items-center justify-between mb-4",
96+
class_name="flex flex-wrap items-center justify-between mb-4",
9797
),
9898
rx.el.div(
9999
rx.el.table(
@@ -158,7 +158,7 @@ def documents_table_section() -> rx.Component:
158158
),
159159
class_name="min-w-full divide-y divide-gray-200",
160160
),
161-
class_name="overflow-hidden border border-gray-200 rounded-lg shadow-sm",
161+
class_name="overflow-x-auto border border-gray-200 rounded-lg shadow-sm",
162162
),
163163
class_name="p-5 bg-white border border-gray-200 rounded-lg shadow-sm mt-5",
164164
)

company_dashboard/company_dashboard/components/sidebar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ def sidebar() -> rx.Component:
6363
class_name="space-y-1",
6464
),
6565
),
66-
class_name="flex flex-col justify-between w-64 h-screen px-2 bg-white border-r border-gray-200 fixed",
66+
class_name="max-md:hidden flex flex-col justify-between w-[280px] h-screen px-2 bg-white border-r border-gray-200 sticky",
6767
)

company_dashboard/company_dashboard/components/visitors_chart.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def visitors_chart_section() -> rx.Component:
3939
time_range_button("Last 7 days"),
4040
class_name="flex items-center space-x-2",
4141
),
42-
class_name="flex items-center justify-between mb-4",
42+
class_name="flex flex-wrap items-center justify-between mb-4 gap-y-2",
4343
),
4444
rx.recharts.area_chart(
4545
rx.recharts.cartesian_grid(
@@ -133,10 +133,10 @@ def visitors_chart_section() -> rx.Component:
133133
y2="1",
134134
),
135135
),
136-
data=DashboardState.visitor_data,
137-
height=300,
136+
data=DashboardState.displayed_visitor_data,
137+
height=360,
138138
margin={
139-
"top": 10,
139+
"top": 25,
140140
"right": 0,
141141
"left": 0,
142142
"bottom": 0,

company_dashboard/company_dashboard/states/dashboard_state.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class DashboardState(rx.State):
3838

3939
key_metrics: List[Metric] = []
4040
visitor_data: List[VisitorDataPoint] = []
41+
displayed_visitor_data: List[VisitorDataPoint] = []
4142
document_data: List[DocumentRow] = []
4243
selected_visitor_timeframe: str = "Last 3 months"
4344
selected_document_tab: str = "Outline"
@@ -102,6 +103,7 @@ def _generate_fake_data(self):
102103
"series2": fake.random_int(min=50, max=300),
103104
}
104105
)
106+
self.displayed_visitor_data = self.visitor_data
105107
self.visitor_data.reverse()
106108
statuses = ["Done", "In Process", "Pending"]
107109
section_types = [
@@ -180,6 +182,15 @@ def load_initial_data(self):
180182
def set_visitor_timeframe(self, timeframe: str):
181183
self.selected_visitor_timeframe = timeframe
182184

185+
if timeframe == "Last 3 months":
186+
self.displayed_visitor_data = self.visitor_data
187+
188+
if timeframe == "Last 30 days":
189+
self.displayed_visitor_data = self.visitor_data[-30:]
190+
191+
if timeframe == "Last 7 days":
192+
self.displayed_visitor_data = self.visitor_data[-7:]
193+
183194
@rx.event
184195
def set_document_tab(self, tab: str):
185196
self.selected_document_tab = tab

0 commit comments

Comments
 (0)