Vinay Jose commited on
Commit
4cc1fcb
·
1 Parent(s): 4781da9

Added title to pages

Browse files
Files changed (3) hide show
  1. .github/workflows/main.yml +1 -4
  2. .gitignore +3 -0
  3. app.py +9 -7
.github/workflows/main.yml CHANGED
@@ -10,9 +10,6 @@ jobs:
10
  runs-on: ubuntu-latest
11
  steps:
12
  - uses: actions/checkout@v4
13
- with:
14
- fetch-depth: 0
15
- lfs: false
16
 
17
  - name: Push to HF Spaces
18
  env:
@@ -20,5 +17,5 @@ jobs:
20
  run: |
21
  git config --global user.email "[email protected]"
22
  git config --global user.name "GitHub Actions"
23
- git push --force https://HuggingFaceBot:[email protected]/spaces/vinay-jose/notesMD main:main
24
 
 
10
  runs-on: ubuntu-latest
11
  steps:
12
  - uses: actions/checkout@v4
 
 
 
13
 
14
  - name: Push to HF Spaces
15
  env:
 
17
  run: |
18
  git config --global user.email "[email protected]"
19
  git config --global user.name "GitHub Actions"
20
+ git push --force https://HuggingFaceBot:[email protected]/spaces/vinay-jose/notesMD HEAD:main
21
 
.gitignore CHANGED
@@ -169,3 +169,6 @@ cython_debug/
169
 
170
  # PyPI configuration file
171
  .pypirc
 
 
 
 
169
 
170
  # PyPI configuration file
171
  .pypirc
172
+
173
+ # FastHTML
174
+ .sesskey
app.py CHANGED
@@ -16,21 +16,23 @@ def load_book(file_path):
16
  def create_mode_picker():
17
  def _opt(val, txt, **kwargs): return Option(txt, value=val, **kwargs)
18
  def _optgrp(key, lbl, opts): return Optgroup(data_key=key, label=lbl)(*opts)
19
- group = _optgrp('mode', 'Mode',
20
  [
21
- _opt('light','Light',data_icon='sun'),
22
- _opt('dark','Dark',data_icon='moon')
23
  ])
24
  return Div(Uk_theme_switcher(
25
  Select(group, hidden=True, selected=True),
26
  id="mode-picker"
27
  ),
28
- cls=stringify('p-4'))
 
 
29
 
30
  def create_book_page(post):
31
  """Create the detailed book page using our template"""
32
  metadata = post.metadata
33
- return Container(
34
  random_theme_script(),
35
  DivCentered(
36
  Card(
@@ -132,7 +134,7 @@ def index():
132
  post = load_book(file)
133
  book_cards.append(create_book_card(post.metadata, file.stem))
134
 
135
- return Container(
136
  create_mode_picker(),
137
  random_theme_script(),
138
  Grid(*book_cards,
@@ -154,7 +156,7 @@ def get(filename: str):
154
  post = load_book(book_file)
155
  return create_book_page(post)
156
  except (FileNotFoundError, ValueError) as e:
157
- return Container(
158
  DivCentered(
159
  H1("Book Not Found", cls=TextT.error),
160
  P("Sorry, we couldn't find the book you're looking for."),
 
16
  def create_mode_picker():
17
  def _opt(val, txt, **kwargs): return Option(txt, value=val, **kwargs)
18
  def _optgrp(key, lbl, opts): return Optgroup(data_key=key, label=lbl)(*opts)
19
+ group = _optgrp('mode', '',
20
  [
21
+ _opt('light','',data_icon='sun'),
22
+ _opt('dark','',data_icon='moon')
23
  ])
24
  return Div(Uk_theme_switcher(
25
  Select(group, hidden=True, selected=True),
26
  id="mode-picker"
27
  ),
28
+ cls="fixed top-4 right-4 z-50 p-2",
29
+ # style="width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;"
30
+ )
31
 
32
  def create_book_page(post):
33
  """Create the detailed book page using our template"""
34
  metadata = post.metadata
35
+ return Title(metadata["title"]), Container(
36
  random_theme_script(),
37
  DivCentered(
38
  Card(
 
134
  post = load_book(file)
135
  book_cards.append(create_book_card(post.metadata, file.stem))
136
 
137
+ return Title("NotesMD"), Container(
138
  create_mode_picker(),
139
  random_theme_script(),
140
  Grid(*book_cards,
 
156
  post = load_book(book_file)
157
  return create_book_page(post)
158
  except (FileNotFoundError, ValueError) as e:
159
+ return Title("Not Found!"), Container(
160
  DivCentered(
161
  H1("Book Not Found", cls=TextT.error),
162
  P("Sorry, we couldn't find the book you're looking for."),