add card deletion to ARA board
This commit is contained in:
parent
9826fbf005
commit
e4a5e752b2
@ -717,6 +717,47 @@ const handleRemoveMinterGroupAdmin = async (name, address) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ADDED: A simple function to effectively 'delete' an AR Board card
|
||||||
|
// by publishing an empty card with the same identifier and prefix
|
||||||
|
const deleteARCard = async (cardIdentifier, prefix) => {
|
||||||
|
try {
|
||||||
|
const confirmed = confirm("Are you sure you want to delete this card? This action cannot be undone.");
|
||||||
|
if (!confirmed) return;
|
||||||
|
|
||||||
|
// A minimal blank object
|
||||||
|
const blankData = {
|
||||||
|
header: "",
|
||||||
|
content: "",
|
||||||
|
links: [],
|
||||||
|
creator: userState.accountName,
|
||||||
|
timestamp: Date.now(),
|
||||||
|
poll: "" // or null. This ensures it won't appear as a valid poll card
|
||||||
|
};
|
||||||
|
|
||||||
|
let base64Data = await objectToBase64(blankData);
|
||||||
|
if (!base64Data) {
|
||||||
|
base64Data = btoa(JSON.stringify(blankData));
|
||||||
|
}
|
||||||
|
|
||||||
|
await qortalRequest({
|
||||||
|
action: "PUBLISH_QDN_RESOURCE",
|
||||||
|
name: userState.accountName,
|
||||||
|
service: "BLOG_POST", // same as all ARBoard content
|
||||||
|
identifier: cardIdentifier,
|
||||||
|
data64: base64Data,
|
||||||
|
});
|
||||||
|
|
||||||
|
alert("Your card has been effectively deleted.");
|
||||||
|
|
||||||
|
// Now reload the existing ARBoard cards so the UI no longer shows the old card
|
||||||
|
await loadCards(prefix);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error deleting AR card:", error);
|
||||||
|
alert("Failed to delete the card. Check console for details.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const fallbackMinterCheck = async (minterName, minterGroupMembers, minterAdmins) => {
|
const fallbackMinterCheck = async (minterName, minterGroupMembers, minterAdmins) => {
|
||||||
// Ensure we have addresses
|
// Ensure we have addresses
|
||||||
if (!minterGroupMembers) {
|
if (!minterGroupMembers) {
|
||||||
@ -893,6 +934,16 @@ const createARCardHTML = async (cardData, pollResults, cardIdentifier, commentCo
|
|||||||
<button class="no" onclick="voteNoOnPoll('${poll}')">NO</button>
|
<button class="no" onclick="voteNoOnPoll('${poll}')">NO</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
${creator === userState.accountName ? `
|
||||||
|
<div style="margin-top: 0.8em;">
|
||||||
|
<button
|
||||||
|
style="padding: 10px; background: darkred; color: white; border-radius: 4px; cursor: pointer;"
|
||||||
|
onclick="deleteARCard('${cardIdentifier}', '${addRemoveIdentifierPrefix}')"
|
||||||
|
>
|
||||||
|
DELETE CARD
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
` : ''}
|
||||||
<div id="comments-section-${cardIdentifier}" class="comments-section" style="display: none; margin-top: 20px;">
|
<div id="comments-section-${cardIdentifier}" class="comments-section" style="display: none; margin-top: 20px;">
|
||||||
<div id="comments-container-${cardIdentifier}" class="comments-container"></div>
|
<div id="comments-container-${cardIdentifier}" class="comments-container"></div>
|
||||||
<textarea id="new-comment-${cardIdentifier}" placeholder="Input your comment..." style="width: 100%; margin-top: 10px;"></textarea>
|
<textarea id="new-comment-${cardIdentifier}" placeholder="Input your comment..." style="width: 100%; margin-top: 10px;"></textarea>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user