Skip to content

Commit

Permalink
chore: clean up UI
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Dec 13, 2023
1 parent bba5206 commit 106a8dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/routes/pr.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
const Handlebars = require('handlebars');
const { Router } = require('express');
const semver = require('semver');
const MarkdownIt = require('markdown-it');
const createDOMPurify = require('dompurify');
const { JSDOM } = require('jsdom');

const window = new JSDOM('').window;
const DOMPurify = createDOMPurify(window);
const md = new MarkdownIt({
html: true,
});

const a = require('../utils/a');
const { compareTagToCommit, getReleasesOrUpdate, getPR, getPRComments } = require('../data');
Expand All @@ -11,6 +20,10 @@ Handlebars.registerHelper('formattedDate', (date) => new Date(date).toUTCString(

Handlebars.registerHelper('sha', (commitSha) => commitSha.substr(0, 7));

Handlebars.registerHelper('markdown', function (content) {
return DOMPurify.sanitize(md.render(content));
});

async function getPRReleaseStatus(prNumber) {
const releases = [...(await getReleasesOrUpdate())].reverse();
const [prInfo, comments] = await Promise.all([getPR(prNumber), getPRComments(prNumber)]);
Expand Down
4 changes: 1 addition & 3 deletions src/routes/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const { getGitHubRelease, getReleasesOrUpdate, getTSDefs } = require('../data');

const window = new JSDOM('').window;
const DOMPurify = createDOMPurify(window);
const md = new MarkdownIt({
html: true,
});
const md = new MarkdownIt({});

const router = new Router();

Expand Down
4 changes: 4 additions & 0 deletions src/static/css/pr.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@
display: flex;
justify-content: center;
}

#grid-pr-body {
padding: 0 15px 0px 15px;
}
4 changes: 2 additions & 2 deletions src/views/pr.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<div class="grid-item">
<h2 class="grid-header">PR Information</h2>
<p class="grid-contents">{{primary.pr.body}}</p>
<div id="grid-pr-body">{{{markdown primary.pr.body}}}</div>
</div>
<div class="grid-item">
<h2 class="grid-header">Release</h2>
Expand Down Expand Up @@ -40,4 +40,4 @@
{{/each}}
</div>
</div>
</div>
</div>

0 comments on commit 106a8dc

Please sign in to comment.