Skip to content

Commit 27aabb8

Browse files
update to frontend
1 parent 59643d4 commit 27aabb8

File tree

10 files changed

+144
-22
lines changed

10 files changed

+144
-22
lines changed

src/app.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
from fastapi import FastAPI, Request
2-
from fastapi.responses import HTMLResponse
1+
from fastapi import FastAPI
32
from fastapi.staticfiles import StaticFiles
4-
from fastapi.templating import Jinja2Templates
53
from fastapi.middleware.cors import CORSMiddleware
6-
from pathlib import Path
74

85
from src.routers.auth.auth_routes import router as auth_router
96
from src.routers.product_routes import router as product_router
107
from src.routers.user_routes import router as user_router
118
from src.routers.sales_routes import router as sales_router
9+
from src.routers.ui_routes import router as ui_router
1210

1311
app = FastAPI(debug=True, reload=True)
1412
app.mount("/static", StaticFiles(directory="src/static"), name="static")
1513

16-
1714
origins = [
1815
"*"
1916
]
@@ -23,16 +20,8 @@
2320
allow_origins = origins
2421
)
2522

26-
BASE_PATH = Path(__file__).resolve().parent
27-
TEMPLATES = Jinja2Templates(directory=str(BASE_PATH / "templates"))
28-
29-
30-
@app.get("/")
31-
def home(request: Request):
32-
return TEMPLATES.TemplateResponse("home/index.html", {"request" : request})
33-
34-
35-
app.include_router(auth_router, prefix='/api')
36-
app.include_router(user_router, prefix='/api')
37-
app.include_router(product_router, prefix='/api')
38-
app.include_router(sales_router, prefix='/api')
23+
app.include_router(auth_router)
24+
app.include_router(user_router)
25+
app.include_router(product_router)
26+
app.include_router(sales_router)
27+
app.include_router(ui_router)

src/routers/auth/auth_routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
router = APIRouter(
13+
prefix = "/api/auth",
1314
tags=['Authentication']
1415
)
1516

src/routers/product_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
router = APIRouter(
12-
prefix = "/products",
12+
prefix = "/api/products",
1313
tags = ['Products']
1414
)
1515

src/routers/sales_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
router = APIRouter(
13-
prefix = "/sales",
13+
prefix = "/api/sales",
1414
tags = ['Sales']
1515
)
1616

src/routers/ui_routes.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from fastapi import APIRouter, Request
2+
from fastapi.responses import HTMLResponse
3+
from fastapi.templating import Jinja2Templates
4+
from pathlib import Path
5+
6+
# from app import TEMPLATES
7+
8+
router = APIRouter(
9+
tags = ['User Interface']
10+
)
11+
12+
BASE_PATH = Path(__file__).resolve().parent
13+
TEMPLATES = Jinja2Templates(directory=str(BASE_PATH / "../templates"))
14+
15+
16+
@router.get("/")
17+
def home(request: Request):
18+
return TEMPLATES.TemplateResponse("home/index.html", {"request" : request})
19+
20+
21+
@router.get("/login")
22+
def login(request: Request):
23+
return TEMPLATES.TemplateResponse("accounts/index.html", {"request" : request})

src/routers/user_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
router = APIRouter(
13-
prefix = "/users",
13+
prefix = "/api/users",
1414
tags = ['Users']
1515
)
1616

src/templates/accounts/login.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ <h3 class="font-weight-bolder text-info text-gradient">
7272
</div>
7373
<div class="col-md-6">
7474
<div class="oblique position-absolute top-0 h-100 d-md-block d-none me-n8">
75-
<div class="oblique-image bg-cover position-absolute fixed-top ms-auto h-100 z-index-0 ms-n6" style="background-image:url("{{url_for('static', path='/img/curved-images/curved6.jpg') }}')"></div>
75+
<div class="oblique-image bg-cover position-absolute fixed-top ms-auto h-100 z-index-0 ms-n6" style="background-image:url({{url_for('static', path='/img/curved-images/curved6.jpg') }}')"></div>
7676
</div>
7777
</div>
7878
</div>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<div class="fixed-plugin">
2+
<a class="fixed-plugin-button text-dark position-fixed px-3 py-2">
3+
<i class="fa fa-cog py-2"> </i>
4+
</a>
5+
<div class="card shadow-lg ">
6+
<div class="card-header pb-0 pt-3 ">
7+
<div class="float-start">
8+
<h5 class="mt-3 mb-0">Soft UI Configurator</h5>
9+
<p>See our dashboard options.</p>
10+
</div>
11+
<div class="float-end mt-4">
12+
<button class="btn btn-link text-dark p-0 fixed-plugin-close-button">
13+
<i class="fa fa-close"></i>
14+
</button>
15+
</div>
16+
<!-- End Toggle Button -->
17+
</div>
18+
<hr class="horizontal dark my-1">
19+
<div class="card-body pt-sm-3 pt-0">
20+
<!-- Sidebar Backgrounds -->
21+
<div>
22+
<h6 class="mb-0">Sidebar Colors</h6>
23+
</div>
24+
<a href="javascript:void(0)" class="switch-trigger background-color">
25+
<div class="badge-colors my-2 text-start">
26+
<span class="badge filter bg-gradient-primary active" data-color="primary" onclick="sidebarColor(this)"></span>
27+
<span class="badge filter bg-gradient-dark" data-color="dark" onclick="sidebarColor(this)"></span>
28+
<span class="badge filter bg-gradient-info" data-color="info" onclick="sidebarColor(this)"></span>
29+
<span class="badge filter bg-gradient-success" data-color="success" onclick="sidebarColor(this)"></span>
30+
<span class="badge filter bg-gradient-warning" data-color="warning" onclick="sidebarColor(this)"></span>
31+
<span class="badge filter bg-gradient-danger" data-color="danger" onclick="sidebarColor(this)"></span>
32+
</div>
33+
</a>
34+
<!-- Sidenav Type -->
35+
<div class="mt-3">
36+
<h6 class="mb-0">Sidenav Type</h6>
37+
<p class="text-sm">Choose between 2 different sidenav types.</p>
38+
</div>
39+
<div class="d-flex">
40+
<button class="btn bg-gradient-primary w-100 px-3 mb-2 active" data-class="bg-transparent" onclick="sidebarType(this)">Transparent</button>
41+
<button class="btn bg-gradient-primary w-100 px-3 mb-2 ms-2" data-class="bg-white" onclick="sidebarType(this)">White</button>
42+
</div>
43+
<p class="text-sm d-xl-none d-block mt-2">You can change the sidenav type just on desktop view.</p>
44+
<!-- Navbar Fixed -->
45+
<div class="mt-3">
46+
<h6 class="mb-0">Navbar Fixed</h6>
47+
</div>
48+
<div class="form-check form-switch ps-0">
49+
<input class="form-check-input mt-1 ms-auto" type="checkbox" id="navbarFixed" onclick="navbarFixed(this)">
50+
</div>
51+
<hr class="horizontal dark my-sm-4">
52+
53+
<a class="btn btn-outline-dark w-100"
54+
target="_blank"
55+
href="https://appseed.us/product/soft-ui-dashboard/flask/">Download</a>
56+
57+
</div>
58+
</div>
59+
</div>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!-- Navbar -->
2+
<nav class="navbar navbar-expand-lg blur blur-rounded top-0 z-index-3 shadow position-absolute my-3 py-2 start-0 end-0 mx-4">
3+
<div class="container-fluid pe-0">
4+
<a class="navbar-brand font-weight-bolder ms-lg-0 ms-3 " href="/">
5+
Soft UI Dashboard
6+
</a>
7+
<button class="navbar-toggler shadow-none ms-2" type="button" data-bs-toggle="collapse" data-bs-target="#navigation" aria-controls="navigation" aria-expanded="false" aria-label="Toggle navigation">
8+
<span class="navbar-toggler-icon mt-2">
9+
<span class="navbar-toggler-bar bar1"></span>
10+
<span class="navbar-toggler-bar bar2"></span>
11+
<span class="navbar-toggler-bar bar3"></span>
12+
</span>
13+
</button>
14+
<div class="collapse navbar-collapse" id="navigation">
15+
<ul class="navbar-nav mx-auto ms-xl-auto">
16+
17+
<li class="nav-item">
18+
<a class="nav-link me-2" href="{{ url_for('authentication_blueprint.register') }}">
19+
<i class="fas fa-user-circle opacity-6 me-1"></i>
20+
Sign Up
21+
</a>
22+
</li>
23+
24+
<li class="nav-item">
25+
<a class="nav-link me-2" href="{{ url_for('authentication_blueprint.login') }}">
26+
<i class="fas fa-key opacity-6 me-1"></i>
27+
Sign In
28+
</a>
29+
</li>
30+
31+
<li class="nav-item">
32+
<label for="theme-switch" class="nav-link me-2">
33+
<i class="fa fa-sun cursor-pointer opacity-6" id="theme-indicator"></i>
34+
Theme
35+
</label>
36+
<input type="checkbox" class="d-none" id="theme-switch"/>
37+
</li>
38+
39+
</ul>
40+
<li class="nav-item d-flex align-items-center">
41+
<a class="btn btn-round btn-sm mb-0 btn-outline-primary me-2"
42+
target="_blank"
43+
href="https://appseed.us/product/soft-ui-dashboard/flask/">Download</a>
44+
</li>
45+
</div>
46+
</div>
47+
</nav>
48+
<!-- End Navbar -->

src/templates/layouts/base.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
</main>
5454

5555
<!-- APP Configurator -->
56+
{% include "includes/fixed-plugin.html" %}
57+
5658

5759
<!-- Core JS Files -->
5860
{% include "includes/scripts.html" %}

0 commit comments

Comments
 (0)