Skip to content

Commit

Permalink
feat: splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
hunger-programmer committed Feb 1, 2024
1 parent e59da75 commit 8fe836f
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 446 deletions.
46 changes: 46 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"express": "^4.17.3",
"express-handlebars": "^7.1.2",
"express-session": "^1.17.3",
"flowbite": "^2.2.1",
"getenv": "^1.0.0",
"hbs": "^4.2.0",
"helmet": "^3.23.3",
Expand Down
1 change: 1 addition & 0 deletions public/tailwind.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './styles/main.scss'
import 'flowbite';
21 changes: 19 additions & 2 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const { engine } =require('express-handlebars');

const app = express();


app.engine('.hbs', engine({
extname: '.hbs',
helpers: {
Expand All @@ -29,6 +28,7 @@ app.engine('.hbs', engine({
}
}
}));

app.set('view engine', '.hbs');
app.set('views', `${__dirname}/views`);

Expand All @@ -52,7 +52,24 @@ oauth.initialize(app);


app.get('/tailwind', asyncMW(async (req, res) => {
res.render('tailwind');
const data = { pkgJson, config };
if (req.isAuthenticated()) {
if (!req.user.userinfo) {
// We came from a purchase flow, and our token doesn't have the 'openid' scope. Let's
// try to redirect to /oauth to "quickly fetch" a token
return res.redirect('/oauth');
}
data.userInfo = req.user.userinfo;
}

res.render('tailwind',{
loginProperties:[
"Popup",
"One step login",
"New Flow"
],
...data
});
}));

app.get('/', asyncMW(async (req, res) => {
Expand Down
8 changes: 6 additions & 2 deletions server/views/layouts/main.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@
<body class="text-blueGray-700 antialiased">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root">
{{> header }}
{{{body}}}
{{> nav }}
<div class="md:ml-64 bg-blueGray-50">
<div class="bg-pink-600 p-4 md:px-8 ">
{{{body}}}
</div>
</div>
{{> footer }}
</div>
<script type="text/javascript">
Expand Down
File renamed without changes.
Loading

0 comments on commit 8fe836f

Please sign in to comment.