export class TRRCUI {

    attachEvents(container, store, renderer, rerender) {

        container.addEventListener("click", e => {

            const card = e.target.closest("[data-node]");

            if (card) {

                const id = card.dataset.node;

                store.goToChild(id);

                rerender();

                return;

            }

            if (e.target.closest(".acx-btn-back")) {

                store.goBack();

                rerender();

            }

            if (e.target.closest(".acx-btn-home")) {

                store.goHome();

                rerender();

            }

        });

    }

}
