Skip to content

Commit

Permalink
Fix video embed dimensions & add option to toggle addition of 'Update…
Browse files Browse the repository at this point in the history
…d' tag in admin mode
  • Loading branch information
amits97 committed Oct 22, 2023
1 parent 1b63bd9 commit 2309bac
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
4 changes: 2 additions & 2 deletions api/posts-service/admin/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export async function main(event, context) {
const createdAt = result.Item.createdAt;
const timeNow = Date.now();

// Set updated at if only 7 days has passed
if (timeNow - createdAt > 1000 * 60 * 60 * 24 * 7) {
// Set updated at if only 7 days has passed and addUpdatedTag flag is true
if (timeNow - createdAt > 1000 * 60 * 60 * 24 * 7 && data.addUpdatedTag) {
updateExpression += ", updatedAt = :updatedAt";
expressionAttributeValues[":updatedAt"] = timeNow;
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "naadan-chords",
"version": "0.78.7",
"version": "0.78.9",
"homepage": "https://www.naadanchords.com/",
"private": true,
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/components/YouTubeEmbed.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
width: 1280px;
max-width: 100%;
margin-bottom: 2em;
max-height: 1070px;
}

.YouTubeEmbed .video-container {
Expand Down
18 changes: 13 additions & 5 deletions src/components/YouTubeEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ import "./YouTubeEmbed.css";
const YouTubeEmbed = ({ youtubeId, onLoad }) => {
return (
<div className="YouTubeEmbed">
<div className="video-wrapper">
<div className="video-container">
<iframe title={`video-${youtubeId}`} src={`https://www.youtube.com/embed/${youtubeId}`} frameBorder="0" allowFullScreen onLoad={onLoad}></iframe>
</div>
</div>
<div className="video-wrapper">
<div className="video-container">
<iframe
title={`video-${youtubeId}`}
src={`https://www.youtube.com/embed/${youtubeId}`}
frameBorder="0"
allowFullScreen
onLoad={onLoad}
width="702"
height="425"
></iframe>
</div>
</div>
</div>
);
};
Expand Down
26 changes: 25 additions & 1 deletion src/containers/account/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default class Editor extends Component {
autoSaveTimestamp: null,
inputUpdated: false,
isChordControlsTrayMaximized: true,
addUpdatedTag: true,
};
}

Expand Down Expand Up @@ -180,7 +181,7 @@ export default class Editor extends Component {
};

preparePostObject = (addUserId) => {
let { isAdmin } = this.props;
let { isAdmin, isEditMode } = this.props;

let postObject = {
title: this.state.title,
Expand All @@ -203,6 +204,11 @@ export default class Editor extends Component {
if (isAdmin && addUserId) {
postObject.userId = this.state.userId;
}

if (isAdmin && isEditMode) {
postObject.addUpdatedTag = this.state.addUpdatedTag;
}

return postObject;
};

Expand Down Expand Up @@ -973,6 +979,24 @@ export default class Editor extends Component {
{this.state.postType === "POST" ? this.renderScaleInputs() : null}
{this.renderContentInputs()}

{isAdmin && isEditMode ? (
<div className="editor-additional-details bg-light border rounded mb-4">
<Form.Check
type="checkbox"
className="checkbox"
onChange={() =>
this.setState({
addUpdatedTag: !this.state.addUpdatedTag,
})
}
checked={this.state.addUpdatedTag}
label={
<span className="ml-2">Add updated tag to post</span>
}
/>
</div>
) : null}

{isAdmin && isReviewMode ? (
<span className="review-submit-container d-inline-block">
<LoaderButton
Expand Down

0 comments on commit 2309bac

Please sign in to comment.