Merge branch 'main' into btn-dropdown
* main: (21 commits) Migration to migrate URLs after renaming bubbles => cards Remove migration Restore bubbles.css since some styles are used Fix issues with styling card__ components Remove bubbles.css Fix renames that the scripts missed Reorganize templates to remove cards/cards redundancy Rename bubbles => cards Safari sure loves outlines Use a number field, and improve focus styles Fix boosting via number input Embed additional video formats Fix that notifications weren't marked as read Fix tray item position Update House to bring patch for history restoration error Tighten up Restore additional missing routes removed inc0f3ff46d7Retore route removed inc0f3ff46d7Fix visual regression in popup menus Perma cards should not always be 100% width ...
This commit is contained in:
+7
-7
@@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
|
||||
const SIZES = [ "one", "two", "three", "four", "five" ]
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "bubble" ]
|
||||
static targets = [ "card" ]
|
||||
|
||||
connect() {
|
||||
this.resize()
|
||||
@@ -12,19 +12,19 @@ export default class extends Controller {
|
||||
resize() {
|
||||
const [ min, max ] = this.#getScoreRange()
|
||||
|
||||
this.bubbleTargets.forEach(bubble => {
|
||||
const score = this.#currentBubbleScore(bubble)
|
||||
this.cardTargets.forEach(card => {
|
||||
const score = this.#currentCardScore(card)
|
||||
const idx = Math.round((score - min) / (max - min) * (SIZES.length - 1))
|
||||
|
||||
bubble.style.setProperty("--bubble-size", `var(--bubble-size-${SIZES[idx]})`)
|
||||
card.style.setProperty("--card-size", `var(--card-size-${SIZES[idx]})`)
|
||||
})
|
||||
}
|
||||
|
||||
#getScoreRange() {
|
||||
var min = 0, max = 1;
|
||||
|
||||
this.bubbleTargets.forEach(bubble => {
|
||||
const score = this.#currentBubbleScore(bubble)
|
||||
this.cardTargets.forEach(card => {
|
||||
const score = this.#currentCardScore(card)
|
||||
|
||||
min = Math.min(min, score)
|
||||
max = Math.max(max, score)
|
||||
@@ -33,7 +33,7 @@ export default class extends Controller {
|
||||
return [ min, max ]
|
||||
}
|
||||
|
||||
#currentBubbleScore(el) {
|
||||
#currentCardScore(el) {
|
||||
const score = el.dataset.activityScore
|
||||
const scoreAt = el.dataset.activityScoreAt
|
||||
const daysAgo = (Date.now() / 1000 - scoreAt) / (60 * 60 * 24)
|
||||
@@ -47,7 +47,7 @@ export default class extends Controller {
|
||||
#triggerChangeEvent(newValue) {
|
||||
if (this.inputTarget.tagName === "HOUSE-MD") {
|
||||
this.inputTarget.dispatchEvent(new CustomEvent('house-md:change', {
|
||||
bubbles: true,
|
||||
cards: true,
|
||||
detail: {
|
||||
previousContent: '',
|
||||
newContent: newValue
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class extends Controller {
|
||||
|
||||
for (const file of files) {
|
||||
const uploadEvent = new CustomEvent("house-md:before-upload", {
|
||||
bubbles: true,
|
||||
cards: true,
|
||||
detail: { file },
|
||||
cancelable: true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user