Follows from O2B-927 Ticket log titles Pull Request Jira ticket

Description

  • Add user feedback when copying a link ✅ 2023-07-28
  • Add text to the button ✅ 2023-07-28
  • Change the colour of tags to be black text on gray-light ✅ 2023-07-28
  • Align the buttons with the title when there is one ✅ 2023-07-31
  • Remove the comma on the author line ✅ 2023-07-31
  • [-] Remove the margin on expanded log
  • Delineate the title and log message ✅ 2023-07-31
  • [-] Move the tags in line with the author string ✅ 2023-07-31
  • Remove the word ‘tags’ ✅ 2023-07-31

Text box Expanded

  • div#log-id-${log.id}
  • markdownDisplay(log.text, { classes: ‘w-100’, id: log-content-${log.id}, }),

collapsed h(a#log-id-${id} h(.text-ellipsis.w-100#log-content-${id}`, text))


Issue: clicking the copy button updates the state of the last log, despite the console log showing the correct states

Solution: This is the working component:

export const logLinkButton = (log, showSuccessContent, onCopyUrlSuccess) => {

const url = `${window.location.origin}/?page=log-detail&id=${log.id}`;

const defaultContent = [iconLinkIntact(), h('', 'Copy Link')];

const successContent = [iconCheck(), h('', 'Copied!')]

  

return clipboardTarget(

url,

h('button.btn.btn-primary', { id: `copy-${log.id}` }, h('div.flex-row.g1', showSuccessContent ? successContent : defaultContent)),

() => { onCopyUrlSuccess();}

)

};

When the constants defaultContent, and successContent were declared outside the component scope, the bug happened. Why???