fix quo hotreload (#15760)

This commit is contained in:
flexsurfer 2023-04-26 18:14:58 +02:00 committed by GitHub
parent efbf93f6e2
commit e6ba40ac17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 91 additions and 88 deletions

View File

@ -92,247 +92,250 @@
(def screens-categories (def screens-categories
{:foundations [{:name :shadows {:foundations [{:name :shadows
:insets {:top false} :options {:topBar {:visible true}}
:component shadows/preview-shadows}] :component shadows/preview-shadows}]
:animated-list [{:name :animated-header-list :animated-list [{:name :animated-header-list
:options {:topBar {:visible false}} :options {:topBar {:visible false}}
:component animated-header-list/mock-screen}] :component animated-header-list/mock-screen}]
:avatar [{:name :group-avatar :avatar [{:name :group-avatar
:insets {:top false} :options {:topBar {:visible true}}
:component group-avatar/preview-group-avatar} :component group-avatar/preview-group-avatar}
{:name :icon-avatar {:name :icon-avatar
:insets {:top false} :options {:topBar {:visible true}}
:component icon-avatar/preview-icon-avatar} :component icon-avatar/preview-icon-avatar}
{:name :user-avatar {:name :user-avatar
:insets {:top false} :options {:topBar {:visible true}}
:component user-avatar/preview-user-avatar} :component user-avatar/preview-user-avatar}
{:name :wallet-user-avatar {:name :wallet-user-avatar
:insets {:top false} :options {:topBar {:visible true}}
:component wallet-user-avatar/preview-wallet-user-avatar} :component wallet-user-avatar/preview-wallet-user-avatar}
{:name :channel-avatar {:name :channel-avatar
:insets {:top false} :options {:topBar {:visible true}}
:component channel-avatar/preview-channel-avatar} :component channel-avatar/preview-channel-avatar}
{:name :account-avatar {:name :account-avatar
:insets {:top false} :options {:topBar {:visible true}}
:component account-avatar/preview-account-avatar}] :component account-avatar/preview-account-avatar}]
:banner [{:name :banner :banner [{:name :banner
:insets {:top false} :options {:topBar {:visible true}}
:component banner/preview-banner}] :component banner/preview-banner}]
:buttons [{:name :button :buttons [{:name :button
:insets {:top false} :options {:topBar {:visible true}}
:component button/preview-button} :component button/preview-button}
{:name :dynamic-button {:name :dynamic-button
:insets {:top false} :options {:topBar {:visible true}}
:component dynamic-button/preview-dynamic-button}] :component dynamic-button/preview-dynamic-button}]
:code [{:name :snippet :code [{:name :snippet
:insets {:top false} :options {:topBar {:visible true}}
:component code-snippet/preview-code-snippet}] :component code-snippet/preview-code-snippet}]
:colors [{:name :color-picker :colors [{:name :color-picker
:insets {:top false} :options {:topBar {:visible true}}
:component color-picker/preview-color-picker}] :component color-picker/preview-color-picker}]
:community [{:name :community-card-view :community [{:name :community-card-view
:insets {:top false} :options {:topBar {:visible true}}
:component community-card/preview-community-card} :component community-card/preview-community-card}
{:name :community-list-view {:name :community-list-view
:insets {:top false} :options {:topBar {:visible true}}
:component community-list-view/preview-community-list-view} :component community-list-view/preview-community-list-view}
{:name :community-membership-list-view {:name :community-membership-list-view
:insets {:top false} :options {:topBar {:visible true}}
:component community-membership-list-view/preview-community-list-view} :component community-membership-list-view/preview-community-list-view}
{:name :discover-card {:name :discover-card
:insets {:top false} :options {:topBar {:visible true}}
:component discover-card/preview-discoverd-card} :component discover-card/preview-discoverd-card}
{:name :token-gating {:name :token-gating
:insets {:top false} :options {:topBar {:visible true}}
:component token-gating/preview-token-gating}] :component token-gating/preview-token-gating}]
:counter [{:name :counter :counter [{:name :counter
:insets {:top false} :options {:topBar {:visible true}}
:component counter/preview-counter} :component counter/preview-counter}
{:name :step {:name :step
:insets {:top false} :options {:topBar {:visible true}}
:component step/preview-step}] :component step/preview-step}]
:dividers [{:name :divider-label :dividers [{:name :divider-label
:inset {:top false} :options {:topBar {:visible true}}
:component divider-label/preview-divider-label} :component divider-label/preview-divider-label}
{:name :new-messages {:name :new-messages
:insets {:top false} :options {:topBar {:visible true}}
:component new-messages/preview-new-messages} :component new-messages/preview-new-messages}
{:name :divider-date {:name :divider-date
:insets {:top false} :options {:topBar {:visible true}}
:component divider-date/preview-divider-date} :component divider-date/preview-divider-date}
{:name :strength-divider {:name :strength-divider
:insets {:top false} :options {:topBar {:visible true}}
:component strength-divider/preview-strength-divider}] :component strength-divider/preview-strength-divider}]
:drawers [{:name :action-drawers :drawers [{:name :action-drawers
:insets {:top false} :options {:topBar {:visible true}}
:component action-drawers/preview-action-drawers} :component action-drawers/preview-action-drawers}
{:name :drawer-buttons {:name :drawer-buttons
:insets {:top false} :options {:topBar {:visible true}}
:component drawer-buttons/preview-drawer-buttons} :component drawer-buttons/preview-drawer-buttons}
{:name :permission-drawers {:name :permission-drawers
:insets {:top false} :options {:topBar {:visible true}}
:component permission-drawers/preview-permission-drawers}] :component permission-drawers/preview-permission-drawers}]
:dropdowns [{:name :dropdown :dropdowns [{:name :dropdown
:insets {:top false} :options {:topBar {:visible true}}
:component dropdown/preview-dropdown}] :component dropdown/preview-dropdown}]
:info [{:name :info-message :info [{:name :info-message
:insets {:top false} :options {:topBar {:visible true}}
:component info-message/preview-info-message} :component info-message/preview-info-message}
{:name :information-box {:name :information-box
:insets {:top false} :options {:topBar {:visible true}}
:component information-box/preview-information-box}] :component information-box/preview-information-box}]
:inputs [{:name :input :inputs [{:name :input
:insets {:top false} :options {:topBar {:visible true}}
:component input/preview-input} :component input/preview-input}
{:name :profile-input {:name :profile-input
:insets {:top false} :options {:topBar {:visible true}}
:component profile-input/preview-profile-input} :component profile-input/preview-profile-input}
{:name :recovery-phrase-input {:name :recovery-phrase-input
:insets {:top false} :options {:topBar {:visible true}}
:component recovery-phrase-input/preview-recovery-phrase-input} :component recovery-phrase-input/preview-recovery-phrase-input}
{:name :search-input {:name :search-input
:insets {:top false} :options {:topBar {:visible true}}
:component search-input/preview-search-input} :component search-input/preview-search-input}
{:name :title-input {:name :title-input
:insets {:top false} :options {:topBar {:visible true}}
:component title-input/preview-title-input}] :component title-input/preview-title-input}]
:links [{:name :url-preview :links [{:name :url-preview
:options {:insets {:top? true}} :options {:insets {:top? true}
:topBar {:visible true}}
:component url-preview/preview} :component url-preview/preview}
{:name :url-preview-list {:name :url-preview-list
:options {:insets {:top? true}} :options {:insets {:top? true}
:topBar {:visible true}}
:component url-preview-list/preview} :component url-preview-list/preview}
{:name :link-preview {:name :link-preview
:options {:insets {:top? true}} :options {:insets {:top? true}
:topBar {:visible true}}
:component link-preview/preview}] :component link-preview/preview}]
:list-items [{:name :channel :list-items [{:name :channel
:insets {:top false} :options {:topBar {:visible true}}
:component channel/preview-channel} :component channel/preview-channel}
{:name :preview-lists {:name :preview-lists
:insets {:top false} :options {:topBar {:visible true}}
:component preview-lists/preview-preview-lists} :component preview-lists/preview-preview-lists}
{:name :user-list {:name :user-list
:insets {:top false} :options {:topBar {:visible true}}
:component user-list/preview-user-list}] :component user-list/preview-user-list}]
:markdown [{:name :texts :markdown [{:name :texts
:insets {:top false} :options {:topBar {:visible true}}
:component text/preview-text}] :component text/preview-text}]
:messages [{:name :gap :messages [{:name :gap
:insets {:top false} :options {:topBar {:visible true}}
:component messages-gap/preview-messages-gap} :component messages-gap/preview-messages-gap}
{:name :system-messages {:name :system-messages
:insets {:top false} :options {:topBar {:visible true}}
:component system-message/preview-system-message} :component system-message/preview-system-message}
{:name :author {:name :author
:insets {:top false} :options {:topBar {:visible true}}
:component messages-author/preview-author}] :component messages-author/preview-author}]
:navigation [{:name :bottom-nav-tab :navigation [{:name :bottom-nav-tab
:insets {:top false} :options {:topBar {:visible true}}
:component bottom-nav-tab/preview-bottom-nav-tab} :component bottom-nav-tab/preview-bottom-nav-tab}
{:name :top-nav {:name :top-nav
:insets {:top false} :options {:topBar {:visible true}}
:component top-nav/preview-top-nav} :component top-nav/preview-top-nav}
{:name :page-nav {:name :page-nav
:insets {:top false} :options {:topBar {:visible true}}
:component page-nav/preview-page-nav} :component page-nav/preview-page-nav}
{:name :floating-shell-button {:name :floating-shell-button
:insets {:top false} :options {:topBar {:visible true}}
:component floating-shell-button/preview-floating-shell-button}] :component floating-shell-button/preview-floating-shell-button}]
:notifications [{:name :activity-logs :notifications [{:name :activity-logs
:insets {:top false} :options {:topBar {:visible true}}
:component activity-logs/preview-activity-logs} :component activity-logs/preview-activity-logs}
{:name :toast {:name :toast
:insets {:top false} :options {:topBar {:visible true}}
:component toast/preview-toasts} :component toast/preview-toasts}
{:name :notification {:name :notification
:insets {:top false} :options {:topBar {:visible true}}
:component notification/preview-notification}] :component notification/preview-notification}]
:onboarding [{:name :small-option-card :onboarding [{:name :small-option-card
:insets {:top false} :options {:topBar {:visible true}}
:component small-option-card/preview-small-option-card}] :component small-option-card/preview-small-option-card}]
:posts-and-attachments [{:name :messages-skeleton :posts-and-attachments [{:name :messages-skeleton
:insets {:top false} :options {:topBar {:visible true}}
:component messages-skeleton/preview-messages-skeleton}] :component messages-skeleton/preview-messages-skeleton}]
:password [{:name :tips :password [{:name :tips
:insets {:top false} :options {:topBar {:visible true}}
:component tips/preview-tips}] :component tips/preview-tips}]
:profile [{:name :profile-card :profile [{:name :profile-card
:insets {:top false} :options {:topBar {:visible true}}
:component profile-card/preview-profile-card} :component profile-card/preview-profile-card}
{:name :collectible {:name :collectible
:insets {:top false} :options {:topBar {:visible true}}
:component collectible/preview-collectible} :component collectible/preview-collectible}
{:name :select-profile {:name :select-profile
:insets {:top false} :options {:topBar {:visible true}}
:component select-profile/preview-select-profile}] :component select-profile/preview-select-profile}]
:reactions [{:name :react :reactions [{:name :react
:insets {:top false} :options {:topBar {:visible true}}
:component react/preview-react}] :component react/preview-react}]
:record-audio [{:name :record-audio :record-audio [{:name :record-audio
:insets {:top false} :options {:topBar {:visible true}}
:component record-audio/preview-record-audio}] :component record-audio/preview-record-audio}]
:switcher [{:name :switcher-cards :switcher [{:name :switcher-cards
:insets {:top false} :options {:topBar {:visible true}}
:component switcher-cards/preview-switcher-cards}] :component switcher-cards/preview-switcher-cards}]
:selectors [{:name :disclaimer :selectors [{:name :disclaimer
:insets {:top false} :options {:topBar {:visible true}}
:component disclaimer/preview-disclaimer} :component disclaimer/preview-disclaimer}
{:name :filter {:name :filter
:insets {:top false} :options {:topBar {:visible true}}
:component filter/preview} :component filter/preview}
{:name :selectors {:name :selectors
:insets {:top false} :options {:topBar {:visible true}}
:component selectors/preview-selectors}] :component selectors/preview-selectors}]
:settings [{:name :privacy-option :settings [{:name :privacy-option
:insets {:top false} :options {:topBar {:visible true}}
:component privacy-option/preview-options} :component privacy-option/preview-options}
{:name :accounts {:name :accounts
:insets {:top false} :options {:topBar {:visible true}}
:component accounts/preview-accounts}] :component accounts/preview-accounts}]
:share [{:name :qr-code :share [{:name :qr-code
:insets {:top false} :options {:topBar {:visible true}}
:component qr-code/preview-qr-code} :component qr-code/preview-qr-code}
{:name :share-qr-code {:name :share-qr-code
:insets {:top false} :options {:topBar {:visible true}}
:component share-qr-code/preview-share-qr-code}] :component share-qr-code/preview-share-qr-code}]
:tabs [{:name :segmented :tabs [{:name :segmented
:insets {:top false} :options {:topBar {:visible true}}
:component segmented/preview-segmented} :component segmented/preview-segmented}
{:name :tabs {:name :tabs
:insets {:top false} :options {:topBar {:visible true}}
:component tabs/preview-tabs} :component tabs/preview-tabs}
{:name :account-selector {:name :account-selector
:insets {:top false} :options {:topBar {:visible true}}
:component account-selector/preview-this}] :component account-selector/preview-this}]
:tags [{:name :context-tags :tags [{:name :context-tags
:insets {:top false} :options {:topBar {:visible true}}
:component context-tags/preview-context-tags} :component context-tags/preview-context-tags}
{:name :tags {:name :tags
:insets {:top false} :options {:topBar {:visible true}}
:component tags/preview-tags} :component tags/preview-tags}
{:name :permission-tag {:name :permission-tag
:insets {:top false} :options {:topBar {:visible true}}
:component permission-tag/preview-permission-tag} :component permission-tag/preview-permission-tag}
{:name :status-tags {:name :status-tags
:insets {:top false} :options {:topBar {:visible true}}
:component status-tags/preview-status-tags} :component status-tags/preview-status-tags}
{:name :token-tag {:name :token-tag
:insets {:top false} :options {:topBar {:visible true}}
:component token-tag/preview-token-tag}] :component token-tag/preview-token-tag}]
:text-combinations [{:name :title :text-combinations [{:name :title
:insets {:top false} :options {:topBar {:visible true}}
:component title/preview-title}] :component title/preview-title}]
:wallet [{:name :lowest-price :wallet [{:name :lowest-price
:insets {:top false} :options {:topBar {:visible true}}
:component lowest-price/preview-lowest-price} :component lowest-price/preview-lowest-price}
{:name :token-overview {:name :token-overview
:insets {:top false} :options {:topBar {:visible true}}
:component token-overview/preview-token-overview} :component token-overview/preview-token-overview}
{:name :network-breakdown {:name :network-breakdown
:insets {:top false} :options {:topBar {:visible true}}
:component network-breakdown/preview-network-breakdown} :component network-breakdown/preview-network-breakdown}
{:name :network-amount {:name :network-amount
:insets {:top false} :options {:topBar {:visible true}}
:component network-amount/preview}]}) :component network-amount/preview}]})
(def screens (flatten (map val screens-categories))) (def screens (flatten (map val screens-categories)))
@ -374,5 +377,5 @@
(def main-screens (def main-screens
[{:name :quo2-preview [{:name :quo2-preview
:insets {:top false} :options {:topBar {:visible true}}
:component main-screen}]) :component main-screen}])

View File

@ -51,13 +51,13 @@
(defn screen (defn screen
[key] [key]
(reagent.core/reactify-component
(fn []
(let [{:keys [component options]} (let [{:keys [component options]}
(get (if js/goog.DEBUG (get-screens) screens) (keyword key)) ;; needed for hot reload (get (if js/goog.DEBUG (get-screens) screens) (keyword key)) ;; needed for hot reload
{:keys [insets sheet?]} options {:keys [insets sheet?]} options
background-color (or (get-in options [:layout :backgroundColor]) background-color (or (get-in options [:layout :backgroundColor])
(when sheet? :transparent))] (when sheet? :transparent))]
(reagent.core/reactify-component
(fn []
^{:key (str "root" key @reloader/cnt)} ^{:key (str "root" key @reloader/cnt)}
[:<> [:<>
[rn/view [rn/view