Revert commits accidentally pushed to main
Revert "Add bridged share button to board and card permas" This reverts commit069e165b43. Revert "Move helper to bridge helper file" This reverts commit1ee37f046c.
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
import { BridgeComponent } from "@hotwired/hotwire-native-bridge"
|
||||
|
||||
export default class extends BridgeComponent {
|
||||
static component = "share"
|
||||
|
||||
share() {
|
||||
const type = this.bridgeElement.bridgeAttribute("share-type")
|
||||
switch (type) {
|
||||
case "card-url":
|
||||
this.send("shareCardUrl", this.#data(type))
|
||||
break
|
||||
default:
|
||||
this.send("shareUrl", this.#data(type))
|
||||
}
|
||||
}
|
||||
|
||||
#data(type) {
|
||||
return {
|
||||
title: document.title,
|
||||
url: window.location.href,
|
||||
...this.#additionalDataFor(type)
|
||||
}
|
||||
}
|
||||
|
||||
#additionalDataFor(type) {
|
||||
switch (type) {
|
||||
case "card-url":
|
||||
return {
|
||||
author: this.#author,
|
||||
dateAdded: this.#dateAdded
|
||||
}
|
||||
default:
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
get #author() {
|
||||
return document.querySelector(".card__meta-text--author strong")?.textContent?.trim() ?? null
|
||||
}
|
||||
|
||||
get #dateAdded() {
|
||||
const timestamp = document.querySelector(".card__meta-text--added time")?.dateTime
|
||||
return parseInt(timestamp) || null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user