0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-10 05:51:33 -05:00

🔥 Remove unused code.

This commit is contained in:
Andrey Antukh 2020-05-27 10:03:00 +02:00
parent 0536b64ae5
commit 5a41d1b4da
29 changed files with 170 additions and 995 deletions

View file

@ -2,6 +2,9 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tests.test-common-pages

View file

@ -1,3 +1,12 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tests.test-services-colors
(:require
[clojure.test :as t]

View file

@ -1,3 +1,12 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tests.test-services-files
(:require
[clojure.test :as t]

View file

@ -1,3 +1,12 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tests.test-services-icons
(:require
[clojure.java.io :as io]

View file

@ -1,3 +1,12 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tests.test-services-images
(:require
[clojure.test :as t]

View file

@ -1,3 +1,12 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tests.test-services-pages
(:require
[clojure.spec.alpha :as s]

View file

@ -1,3 +1,12 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tests.test-services-viewer
(:require
[clojure.test :as t]

View file

@ -1,6 +1,6 @@
{
"auth.already-have-account" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:110" ],
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:107" ],
"translations" : {
"en" : "Already have an account?",
"fr" : "Vous avez déjà un compte ?"
@ -14,41 +14,47 @@
}
},
"auth.create-demo-profile" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:126", "src/uxbox/main/ui/auth/register.cljs:119" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:114", "src/uxbox/main/ui/auth/register.cljs:116" ],
"translations" : {
"en" : "Create demo account",
"fr" : null
}
},
"auth.create-demo-profile-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:123", "src/uxbox/main/ui/auth/register.cljs:116" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:111", "src/uxbox/main/ui/auth/register.cljs:113" ],
"translations" : {
"en" : "Just wanna try it?"
}
},
"auth.demo-warning" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:33" ],
"translations" : {
"en" : "This is a DEMO service, DO NOT USE for real work, the projects will be periodicaly wiped."
}
},
"auth.email-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:46", "src/uxbox/main/ui/auth/login.cljs:83", "src/uxbox/main/ui/auth/register.cljs:85" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:73", "src/uxbox/main/ui/auth/recovery_request.cljs:45", "src/uxbox/main/ui/auth/register.cljs:82" ],
"translations" : {
"en" : "Email",
"fr" : "adresse email"
}
},
"auth.forgot-password" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:114" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:102" ],
"translations" : {
"en" : "Forgot your password?",
"fr" : "Mot de passe oublié ?"
}
},
"auth.fullname-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:79" ],
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:76" ],
"translations" : {
"en" : "Full Name",
"fr" : "Nom complet"
}
},
"auth.go-back-to-login" : {
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:67" ],
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:66" ],
"translations" : {
"en" : "Go back!",
"fr" : "Retour!"
@ -61,26 +67,26 @@
}
},
"auth.login-here" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:113" ],
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:110" ],
"translations" : {
"en" : "Login here"
}
},
"auth.login-submit-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:91" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:81" ],
"translations" : {
"en" : "Sign in",
"fr" : "Se connecter"
}
},
"auth.login-subtitle" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:99" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:89" ],
"translations" : {
"en" : "Enter your details below"
}
},
"auth.login-title" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:98" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:88" ],
"translations" : {
"en" : "Great to see you again!"
}
@ -106,39 +112,39 @@
}
},
"auth.notifications.recovery-token-sent" : {
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:33" ],
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:32" ],
"translations" : {
"en" : "Password recovery link sent to your inbox.",
"fr" : "Lien de récupération de mot de passe envoyé."
}
},
"auth.password-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:89", "src/uxbox/main/ui/auth/register.cljs:89" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:79", "src/uxbox/main/ui/auth/register.cljs:86" ],
"translations" : {
"en" : "Password",
"fr" : "Mot de passe"
}
},
"auth.password-length-hint" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:88" ],
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:85" ],
"translations" : {
"en" : "At least 8 characters"
}
},
"auth.recovery-request-submit-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:51" ],
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:50" ],
"translations" : {
"en" : "Recover Password"
}
},
"auth.recovery-request-subtitle" : {
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:60" ],
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:59" ],
"translations" : {
"en" : "We'll send you an email with instructions"
}
},
"auth.recovery-request-title" : {
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:59" ],
"used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:58" ],
"translations" : {
"en" : "Forgot your password?"
}
@ -150,31 +156,31 @@
}
},
"auth.register" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:120" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:108" ],
"translations" : {
"en" : "Sign up here"
}
},
"auth.register-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:117" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:105" ],
"translations" : {
"en" : "No account yet?"
}
},
"auth.register-submit-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:93" ],
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:90" ],
"translations" : {
"en" : "Create an account"
}
},
"auth.register-subtitle" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:102" ],
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:99" ],
"translations" : {
"en" : "It's free, it's Open Source"
}
},
"auth.register-title" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:101" ],
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:98" ],
"translations" : {
"en" : "Create an account"
}
@ -228,21 +234,21 @@
}
},
"dashboard.header.profile-menu.logout" : {
"used-in" : [ "src/uxbox/main/ui/dashboard/profile.cljs:59" ],
"used-in" : [ "src/uxbox/main/ui/dashboard/profile.cljs:58" ],
"translations" : {
"en" : "Exit",
"fr" : "Quitter"
}
},
"dashboard.header.profile-menu.password" : {
"used-in" : [ "src/uxbox/main/ui/dashboard/profile.cljs:56" ],
"used-in" : [ "src/uxbox/main/ui/dashboard/profile.cljs:55" ],
"translations" : {
"en" : "Password",
"fr" : "Mot de passe"
}
},
"dashboard.header.profile-menu.profile" : {
"used-in" : [ "src/uxbox/main/ui/dashboard/profile.cljs:53" ],
"used-in" : [ "src/uxbox/main/ui/dashboard/profile.cljs:52" ],
"translations" : {
"en" : "Profile",
"fr" : "Profil"
@ -478,7 +484,7 @@
"unused" : true
},
"ds.store-images-title" : {
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:181" ],
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:183" ],
"translations" : {
"en" : "IMAGES STORE",
"fr" : "BOUTIQUE"
@ -499,7 +505,7 @@
"unused" : true
},
"ds.your-images-title" : {
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:178" ],
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:180" ],
"translations" : {
"en" : "YOUR IMAGES",
"fr" : "VOS IMAGES"
@ -520,20 +526,20 @@
"unused" : true
},
"errors.auth.unauthorized" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:38", "src/uxbox/main/ui/auth/login.cljs:72" ],
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:62" ],
"translations" : {
"en" : "Username or password seems to be wrong.",
"fr" : "Le nom d'utilisateur ou le mot de passe semble être faux."
}
},
"errors.email-already-exists" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:39", "src/uxbox/main/ui/auth.cljs:87" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:38", "src/uxbox/main/ui/auth.cljs:87" ],
"translations" : {
"en" : "Email already used"
}
},
"errors.generic" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:38", "src/uxbox/main/ui/auth.cljs:91", "src/uxbox/main/ui.cljs:184" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:37", "src/uxbox/main/ui/auth.cljs:91", "src/uxbox/main/ui.cljs:184" ],
"translations" : {
"en" : "Something wrong has happened.",
"fr" : "Quelque chose c'est mal passé."
@ -560,14 +566,14 @@
}
},
"errors.registration-disabled" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:51" ],
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:48" ],
"translations" : {
"en" : "The registration is currently disabled.",
"fr" : "L'enregistrement est actuellement désactivé."
}
},
"errors.unexpected-error" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:43", "src/uxbox/main/ui/auth/register.cljs:57" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:42", "src/uxbox/main/ui/auth/register.cljs:54" ],
"translations" : {
"en" : "An unexpected error occurred.",
"fr" : "Une erreur inattendue c'est produite"
@ -601,28 +607,28 @@
}
},
"image.import-library" : {
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:170" ],
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:172" ],
"translations" : {
"en" : "Import image from library",
"fr" : "Importer une image depuis une librairie"
}
},
"image.new" : {
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:84" ],
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:86" ],
"translations" : {
"en" : "New image",
"fr" : "Nouvelle image"
}
},
"image.select" : {
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:90", "src/uxbox/main/ui/workspace/images.cljs:95" ],
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:92", "src/uxbox/main/ui/workspace/images.cljs:97" ],
"translations" : {
"en" : "Select from library",
"fr" : "Choisir depuis une librairie"
}
},
"image.upload" : {
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:102" ],
"used-in" : [ "src/uxbox/main/ui/workspace/images.cljs:104" ],
"translations" : {
"en" : "Upload file",
"fr" : "Envoyer un fichier"
@ -648,55 +654,55 @@
}
},
"settings.cancel-email-change" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:82" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:81" ],
"translations" : {
"en" : "Cancel"
}
},
"settings.change-email-info" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:59" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:58" ],
"translations" : {
"en" : "We'll send you an email to your current email “%s” to verify your identity."
}
},
"settings.change-email-info2" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:83" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:82" ],
"translations" : {
"en" : "We have sent you an email to “%s”. Please follow the instructions to verify the email."
}
},
"settings.change-email-info3" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:79" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:78" ],
"translations" : {
"en" : "There is a pending change of your email to “%s”."
}
},
"settings.change-email-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:74" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:73" ],
"translations" : {
"en" : "Change email"
}
},
"settings.change-email-submit-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:73" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:72" ],
"translations" : {
"en" : "Change email"
}
},
"settings.change-email-title" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:55" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:54" ],
"translations" : {
"en" : "Change your email"
}
},
"settings.close-modal-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:87" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:86" ],
"translations" : {
"en" : "Close"
}
},
"settings.confirm-email-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:70" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:69" ],
"translations" : {
"en" : "Verify new email"
}
@ -721,19 +727,19 @@
}
},
"settings.email-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:68" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:67" ],
"translations" : {
"en" : "Email"
}
},
"settings.email-verification-pending" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:87" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:86" ],
"translations" : {
"en" : "There is a pending email validation."
}
},
"settings.fullname-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:61" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:60" ],
"translations" : {
"en" : "Your name",
"fr" : "Votre nom complet"
@ -752,7 +758,7 @@
}
},
"settings.new-email-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:66" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:65" ],
"translations" : {
"en" : "New email"
}
@ -796,7 +802,7 @@
}
},
"settings.notifications.profile-saved" : {
"used-in" : [ "src/uxbox/main/ui/settings/options.cljs:37", "src/uxbox/main/ui/settings/profile.cljs:43" ],
"used-in" : [ "src/uxbox/main/ui/settings/options.cljs:37", "src/uxbox/main/ui/settings/profile.cljs:42" ],
"translations" : {
"en" : "Profile saved successfully!",
"fr" : "Profil enregistré avec succès !"
@ -810,13 +816,13 @@
}
},
"settings.options" : {
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:55" ],
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:54" ],
"translations" : {
"en" : "OPTIONS"
}
},
"settings.password" : {
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:50" ],
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:49" ],
"translations" : {
"en" : "PASSWORD",
"fr" : "MOT DE PASSE"
@ -830,27 +836,27 @@
}
},
"settings.profile" : {
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:45" ],
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:44" ],
"translations" : {
"en" : "PROFILE",
"fr" : "PROFIL"
}
},
"settings.profile-submit-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/options.cljs:65", "src/uxbox/main/ui/settings/password.cljs:94", "src/uxbox/main/ui/settings/profile.cljs:90" ],
"used-in" : [ "src/uxbox/main/ui/settings/options.cljs:65", "src/uxbox/main/ui/settings/password.cljs:94", "src/uxbox/main/ui/settings/profile.cljs:89" ],
"translations" : {
"en" : "Update settings",
"fr" : "Mettre à jour les paramètres"
}
},
"settings.remove-account-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:95" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:94" ],
"translations" : {
"en" : "Want to remove your account?"
}
},
"settings.teams" : {
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:60" ],
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:59" ],
"translations" : {
"en" : "TEAMS"
}
@ -868,7 +874,7 @@
}
},
"settings.update-photo-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:117" ],
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:116" ],
"translations" : {
"en" : "UPDATE"
}
@ -881,7 +887,7 @@
"unused" : true
},
"settings.verification-sent-title" : {
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:78" ],
"used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:77" ],
"translations" : {
"en" : "Verification email sent"
}
@ -1599,7 +1605,7 @@
}
},
"workspace.sidebar.icons" : {
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/icons.cljs:88" ],
"used-in" : [ "src/uxbox/main/ui/workspace/sidebar/icons.cljs:89" ],
"translations" : {
"en" : "Icons",
"fr" : "Icône"

View file

@ -1,53 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.data.lightbox
(:require [beicon.core :as rx]
[lentes.core :as l]
[potok.core :as ptk]
[uxbox.main.store :as st]))
;; --- Show Lightbox
(defrecord ShowLightbox [name params]
ptk/UpdateEvent
(update [_ state]
(let [data (merge {:name name} params)]
(assoc state :lightbox data))))
(defn show-lightbox
([name]
(ShowLightbox. name nil))
([name params]
(ShowLightbox. name params)))
;; --- Hide Lightbox
(defrecord HideLightbox []
ptk/UpdateEvent
(update [_ state]
(dissoc state :lightbox)))
;; TODO: revemo this alias
(defn hide-lightbox
[]
(HideLightbox.))
(defn close-lightbox
[]
(HideLightbox.))
;; --- Direct Call Api
(defn open!
[& args]
(st/emit! (apply show-lightbox args)))
(defn close!
{:deperecated true}
[& args]
(st/emit! (apply hide-lightbox args)))

View file

@ -11,7 +11,6 @@
(:require
[cljs.spec.alpha :as s]
[cuerdas.core :as str]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.common.spec :as us]

View file

@ -11,7 +11,6 @@
(:require
[cljs.spec.alpha :as s]
[cuerdas.core :as str]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.config :as cfg]
[uxbox.main.ui.icons :as i]

View file

@ -1,295 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2015-2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.ui.dashboard.colors
(:require
[cuerdas.core :as str]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.main.data.colors :as dc]
[uxbox.main.store :as st]
[uxbox.main.ui.dashboard.common :as common]
[uxbox.main.ui.colorpicker :refer [colorpicker]]
[uxbox.main.ui.confirm :refer [confirm-dialog]]
[uxbox.main.ui.keyboard :as k]
[uxbox.main.ui.modal :as modal]
[uxbox.util.color :refer [hex->rgb]]
[uxbox.util.data :refer [seek]]
[uxbox.util.dom :as dom]
[uxbox.util.i18n :as t :refer [tr]]
[uxbox.util.router :as rt]))
;; ;; --- Refs
;;
;; (def collections-iref
;; (-> (l/key :colors-collections)
;; (l/derive st/state)))
;;
;; (def selected-colors-iref
;; (-> (l/in [:dashboard :colors :selected])
;; (l/derive st/state)))
;;
;; ;; --- Colors Modal (Component)
;;
;; (mf/defc color-modal
;; [{:keys [on-submit value] :as props}]
;; (let [local (mf/use-var value)]
;; [:div.lightbox-body
;; [:h3 (tr "ds.color-lightbox.title" )]
;; [:form
;; [:div.row-flex.center
;; [:& colorpicker {:value (or @local "#00ccff")
;; :on-change #(reset! local %)}]]
;; [:input#project-btn.btn-primary
;; {:value (tr "ds.color-lightbox.add")
;; :on-click #(on-submit @local)
;; :type "button"}]]]))
;;
;; ;; --- Page Title
;;
;;
;; (mf/defc grid-header
;; [{:keys [coll] :as props}]
;; (letfn [(on-change [name]
;; (st/emit! (dc/rename-collection (:id coll) name)))
;;
;; (delete []
;; (st/emit!
;; (dc/delete-collection (:id coll))
;; (rt/nav :dashboard-colors nil {:type (:type coll)})))
;;
;; (on-delete []
;; (modal/show! confirm-dialog {:on-accept delete}))]
;; [:& common/grid-header {:value (:name coll)
;; :on-change on-change
;; :on-delete on-delete}]))
;;
;; ;; --- Nav
;;
;; (mf/defc nav-item
;; [{:keys [coll selected?] :as props}]
;; (let [local (mf/use-state {})
;; {:keys [id type name]} coll
;; colors (count (:colors coll))
;; editable? (= type :own)]
;; (letfn [(on-click [event]
;; (let [type (or type :own)]
;; (st/emit! (rt/nav :dashboard-colors nil {:type type :id id}))))
;; (on-input-change [event]
;; (let [value (dom/get-target event)
;; value (dom/get-value value)]
;; (swap! local assoc :name value)))
;; (on-cancel [event]
;; (swap! local dissoc :name)
;; (swap! local dissoc :edit))
;; (on-double-click [event]
;; (when editable?
;; (swap! local assoc :edit true)))
;; (on-input-keyup [event]
;; (when (k/enter? event)
;; (let [value (dom/get-target event)
;; value (dom/get-value value)]
;; (st/emit! (dc/rename-collection id (str/trim (:name @local))))
;; (swap! local assoc :edit false))))]
;; [:li {:on-click on-click
;; :on-double-click on-double-click
;; :class-name (when selected? "current")}
;; (if (:edit @local)
;; [:div
;; [:input.element-title
;; {:value (if (:name @local) (:name @local) name)
;; :on-change on-input-change
;; :on-key-down on-input-keyup}]
;; [:span.close {:on-click on-cancel} i/close]]
;; [:span.element-title name])
;; #_[:span.element-subtitle
;; (tr "ds.num-elements" (t/c colors))]])))
;;
;; (mf/defc nav
;; [{:keys [id type colls selected-coll] :as props}]
;; (let [own? (= type :own)
;; builtin? (= type :builtin)
;; select-tab #(st/emit! (rt/nav :dashboard-colors nil {:type %}))]
;; [:div.library-bar
;; [:div.library-bar-inside
;; [:ul.library-tabs
;; [:li {:class-name (when own? "current")
;; :on-click (partial select-tab :own)}
;; (tr "ds.your-colors-title")]
;; [:li {:class-name (when builtin? "current")
;; :on-click (partial select-tab :builtin)}
;; (tr "ds.store-colors-title")]]
;; [:ul.library-elements
;; (when own?
;; [:li
;; [:a.btn-primary {:on-click #(st/emit! (dc/create-collection))}
;; (tr "ds.colors-collection.new")]])
;; (for [item colls]
;; (let [selected? (= (:id item) (:id selected-coll))]
;; [:& nav-item {:coll item :selected? selected? :key (:id item)}]))]]]))
;;
;; ;; --- Grid
;;
;; (mf/defc grid-form
;; [{:keys [id] :as props}]
;; (letfn [(on-submit [val]
;; (st/emit! (dc/add-color id val))
;; (modal/hide!))
;; (on-click [event]
;; (modal/show! color-modal {:on-submit on-submit}))]
;; [:div.grid-item.small-item.add-project {:on-click on-click}
;; [:span (tr "ds.color-new")]]))
;;
;; (mf/defc grid-options-tooltip
;; [{:keys [selected on-select title] :as props}]
;; {:pre [(uuid? selected)
;; (fn? on-select)
;; (string? title)]}
;; (let [colls (mf/deref collections-iref)
;; colls (->> (vals colls)
;; (filter #(= :own (:type %)))
;; (remove #(= selected (:id %)))
;; (sort-by :name colls))
;; on-select (fn [event id]
;; (dom/prevent-default event)
;; (dom/stop-propagation event)
;; (on-select id))]
;; [:ul.move-list
;; [:li.title title]
;; (for [{:keys [id name] :as coll} colls]
;; [:li {:key (str id)}
;; [:a {:on-click #(on-select % id)} name]])]))
;;
;; (mf/defc grid-options
;; [{:keys [id type coll selected] :as props}]
;; (let [local (mf/use-state {})]
;; (letfn [(delete [event]
;; (st/emit! (dc/delete-colors id selected)))
;; (on-delete [event]
;; (modal/show! confirm-dialog {:on-accept delete}))
;; (on-toggle-copy [event]
;; (swap! local update :show-copy-tooltip not)
;; (swap! local assoc :show-move-tooltip false))
;; (on-toggle-move [event]
;; (swap! local update :show-move-tooltip not)
;; (swap! local assoc :show-copy-tooltip false))
;; (on-copy [selected]
;; (swap! local assoc
;; :show-move-tooltip false
;; :show-copy-tooltip false)
;; (st/emit! (dc/copy-selected selected)))
;; (on-move [selected]
;; (swap! local assoc
;; :show-move-tooltip false
;; :show-copy-tooltip false)
;; (st/emit! (dc/move-selected id selected)))]
;;
;; ;; MULTISELECT OPTIONS BAR
;; [:div.multiselect-bar
;; (if (or (= type :own) (nil? id))
;; ;; if editable
;; [:div.multiselect-nav
;; [:span.move-item.tooltip.tooltip-top
;; {:alt (tr "ds.multiselect-bar.copy")
;; :on-click on-toggle-copy}
;; (when (:show-copy-tooltip @local)
;; [:& grid-options-tooltip {:selected id
;; :title (tr "ds.multiselect-bar.copy-to-library")
;; :on-select on-copy}])
;; i/copy]
;; [:span.move-item.tooltip.tooltip-top
;; {:alt (tr "ds.multiselect-bar.move")
;; :on-click on-toggle-move}
;; (when (:show-move-tooltip @local)
;; [:& grid-options-tooltip {:selected id
;; :title (tr "ds.multiselect-bar.move-to-library")
;; :on-select on-move}])
;; i/move]
;; [:span.delete.tooltip.tooltip-top
;; {:alt (tr "ds.multiselect-bar.delete")
;; :on-click on-delete}
;; i/trash]]
;;
;; ;; if not editable
;; [:div.multiselect-nav
;; [:span.move-item.tooltip.tooltip-top
;; {:alt (tr "ds.multiselect-bar.copy")
;; :on-click on-toggle-copy}
;; (when (:show-copy-tooltip @local)
;; [:& grid-options-tooltip {:selected id
;; :title (tr "ds.multiselect-bar.copy-to-library")
;; :on-select on-copy}])
;; i/organize]])])))
;;
;; (mf/defc grid-item
;; [{:keys [color selected?] :as props}]
;; (letfn [(toggle-selection [event]
;; (st/emit! (dc/toggle-color-selection color)))]
;; [:div.grid-item.small-item.project-th {:on-click toggle-selection}
;; [:span.color-swatch {:style {:background-color color}}]
;; [:div.input-checkbox.check-primary
;; [:input {:type "checkbox"
;; :id color
;; :on-change toggle-selection
;; :checked selected?}]
;; [:label {:for color}]]
;; [:span.color-data color]
;; [:span.color-data (apply str "RGB " (interpose ", " (hex->rgb color)))]]))
;;
;; (mf/defc grid
;; [{:keys [id type coll selected] :as props}]
;; (let [{:keys [colors]} coll
;; editable? (= :own type)
;; colors (->> (remove nil? colors)
;; (sort-by identity))]
;; [:div.dashboard-grid-content
;; [:div.dashboard-grid-row
;; (when (and editable? id)
;; [:& grid-form {:id id}])
;; (for [color colors]
;; (let [selected? (contains? selected color)]
;; [:& grid-item {:color color :selected? selected? :key color}]))]]))
;;
;; (mf/defc content
;; [{:keys [id type coll] :as props}]
;; (let [selected (mf/deref selected-colors-iref)]
;; [:section.dashboard-grid.library
;; (when coll
;; [:& grid-header {:coll coll}])
;; [:& grid {:coll coll :id id :type type :selected selected}]
;; (when (seq selected)
;; [:& grid-options {:id id :type type
;; :selected selected
;; :coll coll}])]))
;;
;; ;; --- Colors Page
;;
;; (mf/defc colors-page
;; [{:keys [id type] :as props}]
;; (let [type (or type :own)
;;
;; colls (mf/deref collections-iref)
;; colls (cond->> (vals colls)
;; (= type :own) (filter #(= :own (:type %)))
;; (= type :builtin) (filter #(= :builtin (:type %)))
;; true (sort-by :created-at))
;; selected-coll (if id
;; (seek #(= id (:id %)) colls)
;; (first colls))
;; id (:id selected-coll)]
;;
;; (mf/use-effect #(st/emit! (dc/fetch-collections)))
;;
;; [:section.dashboard-content
;; [:& nav {:type type
;; :id id
;; :colls colls}]
;; [:& content {:type type
;; :id id
;; :coll selected-coll}]]))
;;

View file

@ -1,387 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2015-2020 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2020 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.dashboard.images
(:require
[cljs.spec.alpha :as s]
[cuerdas.core :as str]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.common.data :as d]
[uxbox.common.spec :as us]
[uxbox.main.data.images :as di]
[uxbox.main.store :as st]
[uxbox.main.ui.confirm :refer [confirm-dialog]]
[uxbox.main.ui.dashboard.common :as common]
[uxbox.main.ui.keyboard :as kbd]
[uxbox.main.ui.modal :as modal]
[uxbox.util.dom :as dom]
[uxbox.util.i18n :as i18n :refer [t tr]]
[uxbox.util.router :as rt]
[uxbox.util.time :as dt]))
;; ;; --- Page Title
;;
;; (mf/defc grid-header
;; [{:keys [collection] :as props}]
;; (let [{:keys [id type]} collection
;; on-change #(st/emit! (di/rename-collection id %))
;; on-deleted #(st/emit! (rt/nav :dashboard-images nil {:type type}))
;; delete #(st/emit! (di/delete-collection id on-deleted))
;; on-delete #(modal/show! confirm-dialog {:on-accept delete})]
;; [:& common/grid-header {:value (:name collection)
;; :on-change on-change
;; :on-delete on-delete}]))
;;
;; ;; --- Nav
;;
;; (mf/defc nav-item
;; [{:keys [coll selected?] :as props}]
;; (let [local (mf/use-state {})
;; {:keys [id type name num-images]} coll
;; editable? (= type :own)
;;
;; on-click
;; (fn [event]
;; (let [type (or type :own)]
;; (st/emit! (rt/nav :dashboard-images {} {:type type :id id}))))
;;
;; on-cancel-edition #(swap! local dissoc :edit)
;; on-double-click #(when editable? (swap! local assoc :edit true))
;;
;; on-input-keyup
;; (fn [event]
;; (when (kbd/enter? event)
;; (let [value (-> (dom/get-target event)
;; (dom/get-value)
;; (str/trim))]
;; (st/emit! (di/rename-collection id value))
;; (swap! local assoc :edit false))))]
;;
;; [:li {:on-click on-click
;; :on-double-click on-double-click
;; :class-name (when selected? "current")}
;; (if (:edit @local)
;; [:div
;; [:input.element-title {:default-value name
;; :on-key-down on-input-keyup}]
;; [:span.close {:on-click on-cancel-edition} i/close]]
;; [:span.element-title (if id name "Storage")])]))
;;
;; (mf/defc nav
;; [{:keys [id type collections] :as props}]
;; (let [locale (i18n/use-locale)
;; own? (= type :own)
;; builtin? (= type :builtin)
;; create-collection #(st/emit! di/create-collection)
;; select-own-tab #(st/emit! (rt/nav :dashboard-images nil {:type :own}))
;; select-buitin-tab #(st/emit! (rt/nav :dashboard-images nil {:type :builtin}))]
;; [:div.library-bar
;; [:div.library-bar-inside
;;
;; ;; Tabs
;; [:ul.library-tabs
;; [:li {:class (when own? "current")
;; :on-click select-own-tab}
;; (t locale "ds.your-images-title")]
;;
;; [:li {:class (when builtin? "current")
;; :on-click select-buitin-tab}
;; (t locale "ds.store-images-title")]]
;;
;; ;; Collections List
;; [:ul.library-elements
;; (when own?
;; [:li
;; [:a.btn-primary {:on-click create-collection}
;; (t locale "ds.images-collection.new")]])
;;
;; (for [item collections]
;; [:& nav-item {:coll item
;; :selected? (= (:id item) id)
;; :key (:id item)}])]]]))
;;
;; ;; --- Grid
;;
;; ;; (mf/defc grid-options-tooltip
;; ;; [{:keys [selected on-select title] :as props}]
;; ;; {:pre [(uuid? selected)
;; ;; (fn? on-select)
;; ;; (string? title)]}
;; ;; (let [colls (mf/deref collections-iref)
;; ;; colls (->> (vals colls)
;; ;; (filter #(= :own (:type %)))
;; ;; (remove #(= selected (:id %)))
;; ;; #_(sort-by :name colls))
;; ;; on-select (fn [event id]
;; ;; (dom/prevent-default event)
;; ;; (dom/stop-propagation event)
;; ;; (on-select id))]
;; ;; [:ul.move-list
;; ;; [:li.title title]
;; ;; [:li
;; ;; (when (not (nil? selected))
;; ;; [:a {:href "#" :on-click #(on-select % nil)} "Storage"])]
;; ;; (for [{:keys [id name] :as coll} colls]
;; ;; [:li {:key (pr-str id)}
;; ;; [:a {:on-click #(on-select % id)} name]])]))
;;
;; (mf/defc grid-options
;; [{:keys [id type selected] :as props}]
;; (let [local (mf/use-state {})
;; delete #(st/emit! di/delete-selected)
;; on-delete #(modal/show! confirm-dialog {:on-accept delete})
;;
;; ;; (on-toggle-copy [event]
;; ;; (swap! local update :show-copy-tooltip not))
;; ;; (on-toggle-move [event]
;; ;; (swap! local update :show-move-tooltip not))
;; ;; (on-copy [selected]
;; ;; (swap! local assoc
;; ;; :show-move-tooltip false
;; ;; :show-copy-tooltip false)
;; ;; (st/emit! (di/copy-selected selected)))
;; ;; (on-move [selected]
;; ;; (swap! local assoc
;; ;; :show-move-tooltip false
;; ;; :show-copy-tooltip false)
;; ;; (st/emit! (di/move-selected selected)))
;; ;; (on-rename [event]
;; ;; (let [selected (first selected)]
;; ;; (st/emit! (di/update-opts :edition selected))))
;; ]
;; ;; MULTISELECT OPTIONS BAR
;; [:div.multiselect-bar
;; (when (= type :own)
;; ;; If editable
;; [:div.multiselect-nav
;; ;; [:span.move-item.tooltip.tooltip-top
;; ;; {:alt (tr "ds.multiselect-bar.copy")
;; ;; :on-click on-toggle-copy}
;; ;; (when (:show-copy-tooltip @local)
;; ;; [:& grid-options-tooltip {:selected id
;; ;; :title (tr "ds.multiselect-bar.copy-to-library")
;; ;; :on-select on-copy}])
;; ;; i/copy]
;; ;; [:span.move-item.tooltip.tooltip-top
;; ;; {:alt (tr "ds.multiselect-bar.move")
;; ;; :on-click on-toggle-move}
;; ;; (when (:show-move-tooltip @local)
;; ;; [:& grid-options-tooltip {:selected id
;; ;; :title (tr "ds.multiselect-bar.move-to-library")
;; ;; :on-select on-move}])
;; ;; i/move]
;; ;; (when (= 1 (count selected))
;; ;; [:span.move-item.tooltip.tooltip-top {:alt (tr "ds.multiselect-bar.rename")
;; ;; :on-click on-rename}
;; ;; i/pencil])
;; [:span.delete.tooltip.tooltip-top
;; {:alt (tr "ds.multiselect-bar.delete")
;; :on-click on-delete}
;; i/trash]]
;;
;; ;; If not editable
;; ;; [:div.multiselect-nav
;; ;; [:span.move-item.tooltip.tooltip-top {:alt (tr "ds.multiselect-bar.copy")
;; ;; :on-click on-toggle-copy}
;; ;; (when (:show-copy-tooltip @local)
;; ;; [:& grid-options-tooltip {:selected id
;; ;; :title (tr "ds.multiselect-bar.copy-to-library")
;; ;; :on-select on-copy}])
;; ;; i/organize]]
;; )]))
;;
;;
;; ;; --- Grid Form
;;
;; (mf/defc grid-form
;; [{:keys [id type uploading?] :as props}]
;; (let [input (mf/use-ref nil)
;; on-click #(dom/click (mf/ref-node input))
;; on-select #(st/emit! (->> (dom/get-target %)
;; (dom/get-files)
;; (array-seq)
;; (di/create-images id)))]
;; [:div.grid-item.add-project {:on-click on-click}
;; (if uploading?
;; [:div i/loader-pencil]
;; [:span (tr "ds.image-new")])
;; [:input.upload-image-input
;; {:style {:display "none"}
;; :multiple true
;; :ref input
;; :value ""
;; :accept "image/jpeg,image/png,image/webp"
;; :type "file"
;; :on-change on-select}]]))
;;
;; ;; --- Grid Item
;;
;; (mf/defc grid-item
;; [{:keys [image selected? edition?] :as props}]
;; (let [toggle-selection #(st/emit! (if selected?
;; (di/deselect-image (:id image))
;; (di/select-image (:id image))))
;; on-blur
;; (fn [event]
;; (let [target (dom/get-target event)
;; name (dom/get-value target)]
;; (st/emit! (di/update-opts :edition false)
;; (di/rename-image (:id image) name))))
;;
;; on-key-down
;; (fn [event]
;; (when (kbd/enter? event)
;; (on-blur event)))
;;
;; on-edit
;; (fn [event]
;; (dom/stop-propagation event)
;; (dom/prevent-default event)
;; (st/emit! (di/update-opts :edition (:id image))))
;;
;; background (str "url('" (:thumb-uri image) "')")]
;;
;; [:div.grid-item.images-th
;; [:div.grid-item-th {:style {:background-image background}}
;; [:div.input-checkbox.check-primary
;; [:input {:type "checkbox"
;; :id (:id image)
;; :on-change toggle-selection
;; :checked selected?}]
;; [:label {:for (:id image)}]]]
;;
;; [:div.item-info
;; (if edition?
;; [:input.element-name {:type "text"
;; :auto-focus true
;; :on-key-down on-key-down
;; :on-blur on-blur
;; :on-click on-edit
;; :default-value (:name image)}]
;; [:h3 {:on-double-click on-edit} (:name image)])
;; [:span.date (tr "ds.uploaded-at" (dt/format (:created-at image) "dd/MM/yyyy"))]]]))
;;
;; ;; --- Grid
;;
;; ;; (defn- make-images-iref
;; ;; [collection-id]
;; ;; (letfn [(selector [state]
;; ;; (->> (vals (:images state))
;; ;; (filterv #(= (:collection-id %) collection-id))))]
;; ;; (-> (l/lens selector)
;; ;; (l/derive st/state))))
;;
;; (def images-iref
;; (-> (comp (l/key :images) (l/lens vals))
;; (l/derive st/state)))
;;
;; (mf/defc grid
;; [{:keys [id type collection opts] :as props}]
;; (let [editable? (= type :own)
;; ;; images-iref (mf/use-memo {:fn #(make-images-iref id)
;; ;; :deps (mf/deps id)})
;; images (->> (mf/deref images-iref)
;; (sort-by :created-at))]
;; [:div.dashboard-grid-content
;; [:div.dashboard-grid-row
;; (when editable?
;; [:& grid-form {:id id :type type :uploading? (:uploading opts)}])
;; (for [item images]
;; [:& grid-item {:image item
;; :key (:id item)
;; :selected? (contains? (:selected opts) (:id item))
;; :edition? (= (:edition opts) (:id item))}])]]))
;;
;; ;; --- Menu
;;
;; ;; (mf/defc menu
;; ;; [{:keys [opts coll] :as props}]
;; ;; (let [ordering (:order opts :name)
;; ;; filtering (:filter opts "")
;; ;; icount (count (:images coll))]
;; ;; (letfn [(on-term-change [event]
;; ;; (let [term (-> (dom/get-target event)
;; ;; (dom/get-value))]
;; ;; (st/emit! (di/update-opts :filter term))))
;; ;; (on-ordering-change [event]
;; ;; (let [value (dom/event->value event)
;; ;; value (read-string value)]
;; ;; (st/emit! (di/update-opts :order value))))
;; ;; (on-clear [event]
;; ;; (st/emit! (di/update-opts :filter "")))]
;; ;; [:section.dashboard-bar.library-gap
;; ;; [:div.dashboard-info
;;
;; ;; ;; Counter
;; ;; [:span.dashboard-images (tr "ds.num-images" (t/c icount))]
;;
;; ;; ;; Sorting
;; ;; [:div
;; ;; [:span (tr "ds.ordering")]
;; ;; [:select.input-select {:on-change on-ordering-change
;; ;; :value (pr-str ordering)}
;; ;; (for [[key value] (seq +ordering-options+)]
;; ;; [:option {:key key :value (pr-str key)} (tr value)])]]
;;
;; ;; ;; Search
;; ;; [:form.dashboard-search
;; ;; [:input.input-text {:key :images-search-box
;; ;; :type "text"
;; ;; :on-change on-term-change
;; ;; :auto-focus true
;; ;; :placeholder (tr "ds.search.placeholder")
;; ;; :value filtering}]
;; ;; [:div.clear-search {:on-click on-clear} i/close]]]])))
;;
;; (def opts-iref
;; (-> (l/key :dashboard-images)
;; (l/derive st/state)))
;;
;; (mf/defc content
;; [{:keys [id type collection] :as props}]
;; (let [{:keys [selected] :as opts} (mf/deref opts-iref)]
;; [:section.dashboard-grid.library
;; (when collection
;; [:& grid-header {:collection collection}])
;; (if collection
;; [:& grid {:id id :type type :collection collection :opts opts}]
;; [:span "EMPTY STATE TODO"])
;; (when-not (empty? selected)
;; [:& grid-options {:id id :type type :selected selected}])]))
;;
;; ;; --- Images Page
;;
;; (def collections-iref
;; (-> (l/key :images-collections)
;; (l/derive st/state)))
;;
;; (mf/defc images-page
;; [{:keys [id type] :as props}]
;; (let [collections (mf/deref collections-iref)
;; collections (cond->> (vals collections)
;; (= type :own) (filter #(= :own (:type %)))
;; (= type :builtin) (filter #(= :builtin (:type %)))
;; true (sort-by :created-at))
;;
;; collection (cond
;; (uuid? id) (d/seek #(= id (:id %)) collections)
;; :else (first collections))
;; id (:id collection)]
;;
;; (mf/use-effect #(st/emit! di/fetch-collections))
;; (mf/use-effect
;; {:fn #(when id (st/emit! (di/initialize id)))
;; :deps (mf/deps id)})
;;
;; [:section.dashboard-content
;; [:& nav {:type type :id id :collections collections}]
;; [:& content {:type type :id id :collection collection}]]))

View file

@ -11,15 +11,14 @@
(ns uxbox.main.ui.dashboard.profile
(:require
[cuerdas.core :as str]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.main.data.auth :as da]
[uxbox.main.store :as st]
[uxbox.main.refs :as refs]
[uxbox.main.store :as st]
[uxbox.main.ui.components.dropdown :refer [dropdown]]
[uxbox.main.ui.icons :as i]
[uxbox.main.ui.navigation :as nav]
[uxbox.util.dom :as dom]
[uxbox.main.ui.components.dropdown :refer [dropdown]]
[uxbox.util.i18n :as i18n :refer [t]]
[uxbox.util.router :as rt]))

View file

@ -1,3 +1,12 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.messages
(:require
[rumext.alpha :as mf]

View file

@ -1,7 +1,6 @@
(ns uxbox.main.ui.modal
(:require
[goog.events :as events]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.store :as st]
[uxbox.main.ui.keyboard :as k]

View file

@ -11,19 +11,18 @@
(:require
[cljs.spec.alpha :as s]
[cuerdas.core :as str]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.main.data.auth :as da]
[uxbox.main.data.users :as du]
[uxbox.main.ui.components.forms :refer [input submit-button form]]
[uxbox.main.ui.messages :as msgs]
[uxbox.main.data.messages :as dm]
[uxbox.main.store :as st]
[uxbox.main.data.users :as du]
[uxbox.main.refs :as refs]
[uxbox.main.store :as st]
[uxbox.main.ui.components.forms :refer [input submit-button form]]
[uxbox.main.ui.icons :as i]
[uxbox.main.ui.messages :as msgs]
[uxbox.main.ui.modal :as modal]
[uxbox.util.dom :as dom]
[uxbox.util.forms :as fm]
[uxbox.main.ui.modal :as modal]
[uxbox.util.i18n :as i18n :refer [tr t]]))
(s/def ::email-1 ::fm/email)

View file

@ -9,7 +9,6 @@
(ns uxbox.main.ui.settings.header
(:require
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.main.data.auth :as da]

View file

@ -11,18 +11,17 @@
(:require
[cljs.spec.alpha :as s]
[cuerdas.core :as str]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.main.data.messages :as dm]
[uxbox.main.data.users :as udu]
[uxbox.main.refs :as refs]
[uxbox.main.store :as st]
[uxbox.main.ui.components.forms :refer [input submit-button form]]
[uxbox.main.ui.icons :as i]
[uxbox.main.ui.messages :as msgs]
[uxbox.main.ui.modal :as modal]
[uxbox.main.ui.settings.change-email :refer [change-email-modal]]
[uxbox.main.ui.settings.delete-account :refer [delete-account-modal]]
[uxbox.main.ui.modal :as modal]
[uxbox.main.ui.messages :as msgs]
[uxbox.main.data.messages :as dm]
[uxbox.main.store :as st]
[uxbox.main.refs :as refs]
[uxbox.util.dom :as dom]
[uxbox.util.forms :as fm]
[uxbox.util.i18n :as i18n :refer [tr t]]))

View file

@ -11,7 +11,6 @@
(:require
[goog.events :as events]
[goog.object :as gobj]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.common.data :as d]

View file

@ -10,7 +10,6 @@
(ns uxbox.main.ui.workspace
(:require
[beicon.core :as rx]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.main.constants :as c]

View file

@ -1,141 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.workspace.download
#_(:require [cuerdas.core :as str]
[beicon.core :as rx]
[potok.core :as ptk]
[lentes.core :as l]
[uxbox.main.ui.icons :as i]
[uxbox.main.store :as st]
[uxbox.main.refs :as refs]
[uxbox.main.data.lightbox :as udl]
;; [uxbox.main.exports :as exports]
[uxbox.util.blob :as blob]
[uxbox.util.data :refer (read-string)]
[uxbox.util.time :as dt]
[uxbox.util.dom :as dom]
[uxbox.util.zip :as zip]))
;; --- Refs
;; (defn- resolve-pages
;; [state]
;; (let [project (get-in state [:workspace :project])]
;; (->> (vals (:pages state))
;; (filter #(= project (:project %)))
;; (sort-by :created-at))))
;; (def pages-ref
;; (-> (l/lens resolve-pages)
;; (l/derive st/state)))
;; (def current-page-ref
;; (-> (l/in [:workspace :page])
;; (l/derive st/state)))
;; ;; --- Download Lightbox (Component)
;; (defn- download-page-svg
;; [{:keys [name id] :as page}]
;; (let [content (or #_(exports/render-page id) "")
;; blob (blob/create content "image/svg+xml")
;; uri (blob/create-uri blob)
;; link (.createElement js/document "a")
;; event (js/MouseEvent. "click")
;; now (dt/now)]
;; (.setAttribute link "href" uri)
;; (.setAttribute link "download" (str (str/uslug name) "_"
;; (dt/format now :unix)
;; ".svg"))
;; (.appendChild (.-body js/document) link)
;; (.dispatchEvent link event)
;; (blob/revoke-uri uri)
;; (.removeChild (.-body js/document) link)))
;; (defn- generate-files
;; [pages]
;; (reduce (fn [acc {:keys [id name]}]
;; (let [content (or #_(exports/render-page id) "")]
;; (conj acc [(str (str/uslug name) ".svg")
;; (blob/create content "image/svg+xml")])))
;; []
;; pages))
;; (defn- download-project-zip
;; [{:keys [name] :as project} pages]
;; (let [event (js/MouseEvent. "click")
;; link (.createElement js/document "a")
;; now (dt/now)
;; stream (->> (rx/from (generate-files pages))
;; (rx/reduce conj [])
;; (rx/mapcat zip/build)
;; (rx/map blob/create-uri)
;; (rx/take 1))
;; download (str (str/uslug name) "_" (dt/format now :unix) ".zip")]
;; (rx/subscribe stream (fn [uri]
;; (.setAttribute link "download" download)
;; (.setAttribute link "href" uri)
;; (.appendChild (.-body js/document) link)
;; (.dispatchEvent link event)
;; (blob/revoke-uri uri)
;; (.removeChild (.-body js/document) link)))))
;; (mx/defcs download-dialog
;; {:mixins [mx/static mx/reactive]}
;; [own]
;; #_(let [project (mx/react refs/selected-project)
;; pages (mx/react pages-ref)
;; current (mx/react current-page-ref)]
;; (letfn [(on-close [event]
;; (dom/prevent-default event)
;; (udl/close!))
;; (download-page [event]
;; (dom/prevent-default event)
;; (let [id (-> (mx/ref-node own "page")
;; (dom/get-value)
;; (read-string))
;; page (->> pages
;; (filter #(= id (:id %)))
;; (first))]
;; (download-page-svg page)
;; (udl/close!)))
;; (download-zip [event]
;; (dom/prevent-default event)
;; (download-project-zip project pages)
;; (udl/close!))
;; (download-html [event]
;; (dom/prevent-default event))]
;; [:div.lightbox-body.export-dialog {}
;; [:h3 {} "Download options"]
;; [:div.row-flex {}
;; [:div.content-col {}
;; [:span.icon {} i/file-svg]
;; [:span.title {} "Download page"]
;; [:p.info {} "Download a single page of your project in SVG."]
;; [:select.input-select {:ref "page" :default-value (pr-str current)}
;; (for [{:keys [id name]} pages]
;; [:option {:value (pr-str id) :key (pr-str id)} name])]
;; [:a.btn-primary {:href "#" :on-click download-page} "Download page"]]
;; [:div.content-col {}
;; [:span.icon {} i/folder-zip]
;; [:span.title {} "Download project"]
;; [:p.info {} "Download all pages as svg in a zip file."]
;; [:a.btn-primary {:href "#" :on-click download-zip} "Download project"]]
;; ; [:div.content-col
;; ; [:span.icon i/file-html]
;; ; [:span.title "Download as HTML"]
;; ; [:p.info "Download your project as HTML files."]
;; ; [:a.btn-primary {:href "#" :on-click download-html} "Download HTML"]]
;; ]
;; [:a.close {:href "#" :on-click on-close} i/close]])))
;; (defmethod lbx/render-lightbox :download
;; [_]
;; (download-dialog))

View file

@ -2,8 +2,10 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2015-2019 Andrey Antukh <niwi@niwi.nz>
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.workspace.images
(:require

View file

@ -2,14 +2,15 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2015-2020 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2015-2020 Andrey Antukh <niwi@niwi.nz>
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.workspace.selection
"Selection handlers component."
(:require
[beicon.core :as rx]
[lentes.core :as l]
[cuerdas.core :as str]
[potok.core :as ptk]
[rumext.alpha :as mf]

View file

@ -2,14 +2,16 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.workspace.shapes.text
(:require
[cuerdas.core :as str]
[goog.events :as events]
[goog.object :as gobj]
[lentes.core :as l]
[rumext.alpha :as mf]
[uxbox.common.data :as d]
[uxbox.main.data.workspace :as dw]

View file

@ -5,15 +5,13 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.workspace.sidebar
(:require
[rumext.alpha :as mf]
[cuerdas.core :as str]
[uxbox.main.ui.workspace.sidebar.history :refer [history-toolbox]]
[uxbox.main.ui.workspace.sidebar.icons :refer [icons-toolbox]]
[uxbox.main.ui.workspace.sidebar.layers :refer [layers-toolbox]]
[uxbox.main.ui.workspace.sidebar.options :refer [options-toolbox]]
[uxbox.main.ui.workspace.sidebar.sitemap :refer [sitemap-toolbox]]
@ -45,6 +43,4 @@
[:aside#settings-bar.settings-bar
[:div.settings-bar-inside
(when (contains? layout :element-options)
[:& options-toolbox {:page page}])
(when (contains? layout :icons)
[:& icons-toolbox])]])
[:& options-toolbox {:page page}])]])

View file

@ -2,20 +2,21 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main.ui.workspace.sidebar.icons
(:require
[lentes.core :as l]
#_[uxbox.main.ui.dashboard.icons :as icons]
[rumext.alpha :as mf]
[uxbox.common.data :as d]
[uxbox.main.ui.icons :as i]
[uxbox.main.data.icons :as di]
[uxbox.main.data.workspace :as dw]
[uxbox.main.refs :as refs]
[uxbox.main.store :as st]
#_[uxbox.main.ui.dashboard.icons :as icons]
[uxbox.main.ui.icons :as i]
[uxbox.main.ui.shapes.icon :as icon]
[uxbox.util.data :refer [read-string]]
[uxbox.util.dom :as dom]

View file

@ -2,7 +2,10 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.util.forms
(:refer-clojure :exclude [uuid])
@ -10,7 +13,6 @@
[beicon.core :as rx]
[cljs.spec.alpha :as s]
[cuerdas.core :as str]
[lentes.core :as l]
[potok.core :as ptk]
[rumext.alpha :as mf]
[uxbox.common.spec :as us]

View file

@ -1,16 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.util.lens
(:refer-clojure :exclude [merge])
(:require [lentes.core :as l]))
(defn merge
[data]
(l/lens
(fn [s] (cljs.core/merge s data))
#(throw (ex-info "Not implemented" {}))))