diff --git a/packages/app/src/components/AdminTools/UserDataManager/index.jsx b/packages/app/src/components/AdminTools/UserDataManager/index.jsx
deleted file mode 100755
index cafb349f..00000000
--- a/packages/app/src/components/AdminTools/UserDataManager/index.jsx
+++ /dev/null
@@ -1,204 +0,0 @@
-import React from "react"
-import * as antd from "antd"
-import debounce from "lodash/debounce"
-import { Translation } from "react-i18next"
-
-import { ActionsBar } from "components"
-import { Icons } from "components/Icons"
-
-import "./index.less"
-
-export const EditAccountField = ({ id, component, props, header, handleChange, delay, defaultValue, allowEmpty }) => {
- const [currentValue, setCurrentValue] = React.useState(defaultValue)
- const [emittedValue, setEmittedValue] = React.useState(null)
-
- const debouncedHandleChange = React.useCallback(
- debounce((value) => handleChange({ id, value }), delay ?? 300),
- [],
- )
-
- const handleDiscard = (event) => {
- if (typeof event !== "undefined") {
- event.target.blur()
- }
-
- setCurrentValue(defaultValue)
- handleChange({ id, value: defaultValue })
- }
-
- React.useEffect(() => {
- debouncedHandleChange(currentValue)
- }, [emittedValue])
-
- const onChange = (event) => {
- event.persist()
- let { value } = event.target
-
- if (typeof value === "string") {
- if (value.length === 0) {
- // if is not allowed to be empty, discard modifications
- if (!allowEmpty) {
- return handleDiscard(event)
- }
- }
- }
-
- setCurrentValue(value)
- setEmittedValue(value)
- }
-
- const handleKeyDown = (event) => {
- if (event.keyCode === 27) {
- // "escape" pressed, reset to default value
- handleDiscard(event)
- }
- }
-
- const RenderComponent = component
-
- return (
-
- {header ? header : null}
-
-
- )
-}
-
-export default class UserDataManager extends React.Component {
- state = {
- data: this.props.user,
- changes: [],
- loading: false,
- }
-
- api = window.app.cores.api.withEndpoints()
-
- componentDidMount = async () => {
- if (!this.props.user && this.props.userId) {
- // TODO: Fetch from API
- }
- }
-
- handleSave = async () => {
- if (!Array.isArray(this.state.changes)) {
- antd.message.error("Something went wrong")
- console.error("Changes should be an array")
- return false
- }
-
- await this.setState({ loading: true })
- const update = {}
-
- this.state.changes.forEach((change) => {
- update[change.id] = change.value
- })
-
- const result = await this.api.post.updateUser({ _id: this.state.data._id, update }).catch((err) => {
- antd.message.error(err.message)
- console.error(err)
- return false
- })
-
- await this.setState({ changes: [], loading: false })
-
- if (typeof this.props.onSave === "function") {
- await this.props.onSave(this.state.changes)
- }
-
- if (result) {
- if (typeof this.props.handleDone === "function") {
- this.props.handleDone(result)
- }
- }
- }
-
- handleChange = (event) => {
- const { id, value } = event
- let changes = [...this.state.changes]
-
- changes = changes.filter((change) => change.id !== id)
-
- if (this.state.data[id] !== value) {
- changes.push({ id, value })
- }
-
- this.setState({ changes })
- }
-
- render() {
- return (
-
-
-
-
- Account information
-
-
- Username
-
- }
- component={antd.Input}
- props={{
- placeholder: "Username",
- disabled: true,
- }}
- handleChange={this.handleChange}
- />
-
- Name
-
- }
- component={antd.Input}
- props={{
- placeholder: "Your full name",
- }}
- handleChange={this.handleChange}
- />
-
- Email
-
- }
- component={antd.Input}
- props={{
- placeholder: "Your email address",
- type: "email",
- }}
- handleChange={this.handleChange}
- />
-
-
-
-
- {this.state.changes.length}
- {(t) => t("Changes")}
-
-
-
-
-
- {(t) => t("Save")}
-
-
-
-
-
- )
- }
-}
diff --git a/packages/app/src/components/AdminTools/UserDataManager/index.less b/packages/app/src/components/AdminTools/UserDataManager/index.less
deleted file mode 100755
index 08713209..00000000
--- a/packages/app/src/components/AdminTools/UserDataManager/index.less
+++ /dev/null
@@ -1,61 +0,0 @@
-.edit_account{
- overflow: hidden!important;
- height: 100%;
-}
-
-.edit_account_wrapper{
- overflow: scroll;
- > div {
- margin-bottom: 20px;
- }
-}
-
-.edit_account_actions {
- position: absolute;
- bottom: 0;
- right: 0;
-
- flex-direction: row;
- align-items: center;
- justify-content: center;
-
- width: 100%;
- padding: 20px 0 20px 0;
- background-color: rgba(221, 221, 221, 0.5);
- backdrop-filter: blur(2px);
- --webkit-backdrop-filter: blur(2px);
- border-radius: 18px 18px 0 0;
-
- transition: all 0.3s ease-in-out;
-
- display: none;
- opacity: 0;
-
- &.show {
- display: flex;
- opacity: 1;
- }
-
- > div {
- margin-left: 20px;
- }
-}
-
-.edit_account_actions_indicator{
- position: fixed;
- left: 0;
- margin-left: 30px;
-}
-
-.edit_account_category{
- > div {
- margin-bottom: 20px;
- margin-left: 20px;
- }
-}
-
-.edit_account_field {
- input:not(:focus){
- color:rgba(105, 105, 105, 0.5)
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/components/AdminTools/UserRolesManager/index.jsx b/packages/app/src/components/AdminTools/UserRolesManager/index.jsx
deleted file mode 100755
index 5410c263..00000000
--- a/packages/app/src/components/AdminTools/UserRolesManager/index.jsx
+++ /dev/null
@@ -1,140 +0,0 @@
-import React from "react"
-import * as antd from "antd"
-
-import { ActionsBar, UserSelector, Skeleton } from "components"
-import { Icons } from "components/Icons"
-
-import "./index.less"
-
-export default class UserRolesManager extends React.Component {
- state = {
- users: null,
- roles: null,
- }
-
- api = window.app.cores.api.withEndpoints()
-
- componentDidMount = async () => {
- await this.fetchRoles()
-
- if (typeof this.props.id !== "undefined") {
- const ids = Array.isArray(this.props.id) ? this.props.id : [this.props.id]
- await this.fetchUsersData(ids)
- }
- }
-
- fetchRoles = async () => {
- const result = await this.api.get.roles().catch((err) => {
- antd.message.error(err)
- console.error(err)
- return false
- })
-
- if (result) {
- this.setState({ roles: result })
- }
- }
-
- fetchUsersData = async (users) => {
- const result = await this.api.get.users(undefined, { _id: users }).catch((err) => {
- antd.message.error(err)
- console.error(err)
- return false
- })
-
- if (result) {
- this.setState({
- users: result.map((data) => {
- return {
- _id: data._id,
- username: data.username,
- roles: data.roles,
- }
- })
- })
- }
- }
-
- handleSelectUser = async (users) => {
- this.fetchUsersData(users)
- }
-
- handleRoleChange = (userId, role, to) => {
- let updatedUsers = this.state.users.map((user) => {
- if (user._id === userId) {
- if (to == true) {
- user.roles.push(role)
- } else {
- user.roles = user.roles.filter((r) => r !== role)
- }
- }
-
- return user
- })
-
- this.setState({ users: updatedUsers })
- }
-
- handleSubmit = async () => {
- const update = this.state.users.map((data) => {
- return {
- _id: data._id,
- roles: data.roles,
- }
- })
-
- const result = await this.api.post.updateUserRoles({ update }).catch((err) => {
- antd.message.error(err)
- console.error(err)
- return false
- })
-
- if (result) {
- this.props.handleDone(result)
- if (typeof this.props.close === "function") {
- this.props.close()
- }
- }
- }
-
- renderItem = (item) => {
- return
-
- {item.username}
-
-
- {this.state.roles.map((role) => {
- return
this.handleRoleChange(item._id, role.name, to.target.checked)}
- >
- {role.name}
-
- })}
-
-
- }
-
- render() {
- const { users } = this.state
-
- if (!users) {
- return
- }
-
- return
- {users.map((data) => {
- return this.renderItem(data)
- })}
-
-
-
-
} onClick={() => this.handleSubmit()}>
- Submit
-
-
-
-
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/components/AdminTools/UserRolesManager/index.less b/packages/app/src/components/AdminTools/UserRolesManager/index.less
deleted file mode 100755
index bd373174..00000000
--- a/packages/app/src/components/AdminTools/UserRolesManager/index.less
+++ /dev/null
@@ -1,19 +0,0 @@
-.grantRoles_user {
- display: flex;
- flex-direction: column;
-
- .roles {
- display: inline-flex;
- flex-direction: row;
- flex-wrap: wrap;
-
- padding: 10px;
- border-radius: 8px;
-
- background-color: var(--background-color-accent);
- }
-
- > div {
- margin-bottom: 10px;
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/components/AdminTools/index.js b/packages/app/src/components/AdminTools/index.js
deleted file mode 100755
index a570f549..00000000
--- a/packages/app/src/components/AdminTools/index.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import UserDataManager from "./UserDataManager"
-import UserRolesManager from "./UserRolesManager"
-
-export { UserDataManager, UserRolesManager }
-
-export const open = {
- dataManager: (user) => {
- return new Promise((resolve, reject) => {
- window.app.DrawerController.open("UserDataManager", UserDataManager, {
- componentProps: {
- user: user,
- },
- onDone: (ctx, value) => {
- resolve(value)
- ctx.close()
- },
- onFail: (ctx, value) => {
- reject(value)
- ctx.close()
- }
- })
- })
- },
- rolesManager: (id) => {
- return new Promise((resolve, reject) => {
- window.app.DrawerController.open("UserRolesManager", UserRolesManager, {
- componentProps: {
- id: id,
- },
- onDone: (ctx, value) => {
- resolve(value)
- ctx.close()
- },
- onFail: (ctx, value) => {
- reject(value)
- ctx.close()
- }
- })
- })
- }
-}
\ No newline at end of file
diff --git a/packages/app/src/components/index.js b/packages/app/src/components/index.js
index d539f716..13e43d96 100755
--- a/packages/app/src/components/index.js
+++ b/packages/app/src/components/index.js
@@ -1,32 +1,33 @@
import * as Layout from "./Layout"
export { default as Footer } from "./Footer"
+export { default as Clock } from "./Clock"
+
+export { default as RenderError } from "./RenderError"
+export { default as NotFound } from "./NotFound"
+export * as Crash from "./Crash"
+
+export { default as UserRegister } from "./UserRegister"
+export { default as Login } from "./Login"
+
// COMPLEX COMPONENTS
export { default as FormGenerator } from "./FormGenerator"
-export { default as NotFound } from "./NotFound"
-export { default as RenderError } from "./RenderError"
export { default as ActionsBar } from "./ActionsBar"
export { default as SelectableList } from "./SelectableList"
export { default as ObjectInspector } from "./ObjectInspector"
export { default as ModifierTag } from "./ModifierTag"
-export { default as UserSelector } from "./UserSelector"
-export { default as Clock } from "./Clock"
export { default as StepsForm } from "./StepsForm"
export { default as DraggableDrawer } from "./DraggableDrawer"
-export * as Crash from "./Crash"
export { default as SearchButton } from "./SearchButton"
-export { default as UserRegister } from "./UserRegister"
export { default as Skeleton } from "./Skeleton"
export { default as Navigation } from "./Navigation"
export { default as ImageUploader } from "./ImageUploader"
export { default as ImageViewer } from "./ImageViewer"
-export { default as Login } from "./Login"
export { default as Image } from "./Image"
export { default as LoadMore } from "./LoadMore"
export { default as EmbbededMediaPlayer } from "./EmbbededMediaPlayer"
export { default as HashtagTrendings } from "./HashtagTrendings"
export { default as Searcher } from "./Searcher"
-export { default as UserPreview } from "./UserPreview"
export { default as FeaturedEventAnnouncement } from "./FeaturedEventAnnouncement"
export { default as FeaturedEventsAnnouncements } from "./FeaturedEventsAnnouncements"
@@ -55,9 +56,10 @@ export { default as UserBadges } from "./UserBadges"
export { default as UserCard } from "./UserCard"
export { default as FollowersList } from "./FollowersList"
export { default as ConnectedFriends } from "./ConnectedFriends"
+export { default as UserSelector } from "./UserSelector"
+export { default as UserPreview } from "./UserPreview"
// OTHERS
-export * as AdminTools from "./AdminTools"
export * as Window from "./RenderWindow"
export { Layout }
\ No newline at end of file