Skip to content

Commit

Permalink
now formatting modals and overlays with emotes (#269)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
csharpfritz and github-actions[bot] authored Oct 31, 2023
1 parent db43de3 commit cb15ea9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/TagzApp.Web/Pages/Overlay.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</div>

<script src="~/lib/microsoft-signalr/signalr.min.js"></script>
<script src="~/js/site.js"></script>

@if (!string.IsNullOrEmpty(Model.Tag))
{
Expand Down Expand Up @@ -63,7 +64,7 @@
</div>
<i class="provider bi bi-${content.provider.toLowerCase()}"></i>
<span class="time">${new Date(content.timestamp).toLocaleString(undefined, { day: 'numeric', month: 'long', year: 'numeric', hour: '2-digit', minute: '2-digit' })}</span>
<span class="content">${content.text}</span>
<span class="content">${window.TagzApp.FormatContentWithEmotes(content)}</span>
`;
if (content.previewCard) {
Expand Down
2 changes: 1 addition & 1 deletion src/TagzApp.Web/Pages/PortraitOverlay.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</div>
<i class="provider bi ${window.TagzApp.MapProviderToIconClass(content.provider)}"></i>
<span class="time">${new Date(content.timestamp).toLocaleString(undefined, { day: 'numeric', month: 'long', year: 'numeric', hour: '2-digit', minute: '2-digit' })}</span>
<span class="content">${content.text}</span>
<span class="content">${window.TagzApp.FormatContentWithEmotes(content)}</span>
`;
if (content.previewCard) {
Expand Down
47 changes: 30 additions & 17 deletions src/TagzApp.Web/wwwroot/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Unmoderated: '0',
};

var tagCsv = "";
var tagCsv = '';
var paused = false;
var rolloverPause = false;
var pauseQueue = [];
Expand Down Expand Up @@ -191,7 +191,7 @@
})}`;

let modalBody = (document.querySelector('.modal-body').innerHTML =
content.text);
FormatContextWithEmotes(content));

if (
content.previewCard &&
Expand Down Expand Up @@ -349,22 +349,34 @@
return text;
}

function LoadAdditionalContentForFilters()
{

function LoadAdditionalContentForFilters() {
// only proceed if less than 20 article elements are visible
if (document.querySelectorAll('article:not([style*="display: none"])').length < 20) return;
if (
document.querySelectorAll('article:not([style*="display: none"])')
.length < 20
)
return;

// use the SignalR connection to call the server and get the additional content
connection.invoke('GetFilteredContentByTag', tagCsv, providerFilter, approvedFilterStatus).then(function (result) {
console.log(`Received ${result.length} additional messages from server`);
result.forEach(function (content) {
console.log(`Formatting ${content.providerId} with state ${content.state}`);
FormatMessageForModeration(content);
connection
.invoke(
'GetFilteredContentByTag',
tagCsv,
providerFilter,
approvedFilterStatus,
)
.then(function (result) {
console.log(
`Received ${result.length} additional messages from server`,
);
result.forEach(function (content) {
console.log(
`Formatting ${content.providerId} with state ${content.state}`,
);
FormatMessageForModeration(content);
});
window.Masonry.resizeAllGridItems();
});
window.Masonry.resizeAllGridItems();
});

}

function ApproveMessage(content) {
Expand Down Expand Up @@ -595,6 +607,10 @@
return MapProviderToIcon(provider);
},

FormatContentWithEmotes: function (content) {
return FormatContextWithEmotes(content);
},

FilterByApprovalStatus: function (status) {
let taggedContent = document.getElementById('taggedContent');
approvedFilterStatus = status;
Expand All @@ -619,11 +635,9 @@
taggedContent.classList.remove('filter-rejectedOnly');
taggedContent.classList.add('filter-needsModeration');
break;

}

LoadAdditionalContentForFilters();

},

ListenForWaterfallContent: async function (tags) {
Expand Down Expand Up @@ -774,7 +788,6 @@
}

if (providerFilter.length > 0) LoadAdditionalContentForFilters();

},
};

Expand Down

0 comments on commit cb15ea9

Please sign in to comment.