Skip to content

Commit

Permalink
Fix name truncate regression
Browse files Browse the repository at this point in the history
  • Loading branch information
daya0576 committed Feb 3, 2025
1 parent 319b550 commit f271635
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ To avoid [permission issues](https://github.com/daya0576/beaverhabits/discussion
| **ENABLE_IOS_STANDALONE**(bool) | Experiential feature to enable standalone mode on iOS. The default setting is `false`. |
| **INDEX_SHOW_HABIT_COUNT**(bool) | To display total completed count along with the habit name on the index page. The default setting is `false`. |
| **INDEX_HABIT_NAME_COLUMNS**(int) | Customize the habit name column count for the index page. The default value is `5`. |
| **INDEX_HABIT_DATE_COLUMNS**(int) | Customize the date column count for the index page. The default value is `2`. |
| **INDEX_HABIT_DATE_COLUMNS**(int) | Customize the date column count for the index page. The default value is `5`. |
| **TRUSTED_EMAIL_HEADER**(str) | Delegate authentication to an authenticating reverse proxy that passes in the user's details in HTTP headers, e.g. `Cf-Access-Authenticated-User-Email`. An existing account is required. |
| **TRUSTED_LOCAL_EMAIL**(str) | Disables authentication entirely. A new account with the specified email will be created if it does not exist. |

Expand Down
2 changes: 1 addition & 1 deletion beaverhabits/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Settings(BaseSettings):
ENABLE_DESKTOP_ALGIN_CENTER: bool = True

INDEX_SHOW_HABIT_COUNT: bool = False
INDEX_HABIT_NAME_COLUMNS: int = 2
INDEX_HABIT_NAME_COLUMNS: int = 5
INDEX_HABIT_DATE_COLUMNS: int = 5

def is_dev(self):
Expand Down
8 changes: 4 additions & 4 deletions beaverhabits/frontend/index_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ def day_headers(days: list[datetime.date]):
@ui.refreshable
def habit_list_ui(days: list[datetime.date], active_habits: List[Habit]):
# Calculate column count
name_columns, date_columns = 2 * settings.INDEX_HABIT_NAME_COLUMNS, 2
name_columns, date_columns = settings.INDEX_HABIT_NAME_COLUMNS, 2
count_columns = 2 if settings.INDEX_SHOW_HABIT_COUNT else 0
columns = name_columns + len(days) * date_columns + count_columns

row_compat_classes = "pl-4 pr-0 py-0"
left_classes, right_classes = (
# grid 4
# grid 5
f"col-span-{name_columns} truncate",
# grid 2 2 2 2 2
f"col-span-{date_columns} px-1.5 place-self-center",
f"col-span-{date_columns} px-1 place-self-center",
)
header_styles = "font-size: 85%; font-weight: 500; color: #9e9e9e"

Expand All @@ -64,7 +64,7 @@ def habit_list_ui(days: list[datetime.date], active_habits: List[Habit]):
root_path = get_root_path()
redirect_page = os.path.join(root_path, "habits", str(habit.id))
name = link(habit.name, target=redirect_page).classes(left_classes)
name.style(f"max-width: {52 * name_columns / date_columns}px;")
name.style(f"max-width: {24 * name_columns}px;")

ticked_days = set(habit.ticked_days)
for day in days:
Expand Down

0 comments on commit f271635

Please sign in to comment.