diff --git a/.vscode/settings.json b/.vscode/settings.json index 7d8a366c..0ab8a5b4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,6 @@ "source.fixAll.eslint": "always" }, "[typescriptreact]": { - "editor.defaultFormatter": "vscode.typescript-language-features" + "editor.defaultFormatter": "esbenp.prettier-vscode" }, } \ No newline at end of file diff --git a/app/components/dashboard/MemberManagement.tsx b/app/components/dashboard/MemberManagement.tsx new file mode 100644 index 00000000..db72b9e8 --- /dev/null +++ b/app/components/dashboard/MemberManagement.tsx @@ -0,0 +1,136 @@ +import { Link } from "@remix-run/react"; +import { ArrowRight, Check, ChevronDown, Search } from "lucide-react"; +import { ChangeEvent, useEffect, useState } from "react"; + +import UserList from "./UserList"; + +function MemberManagement() { + const [search, setSearch] = useState(""); + const [filter, setFilter] = useState("All"); + const [display, setDisplay] = useState("none"); + + // search + const handleSearch = (event: ChangeEvent) => { + setSearch(event.target.value); + }; + + // filter buttons + const accountType_button: string[] = [ + "All", + "Members", + "Suspended", + "Left workspace", + ]; + // demo card design for users + + useEffect(() => { + const handleClick = () => { + setDisplay("none"); + }; + + window.addEventListener("click", handleClick); + + return () => { + window.removeEventListener("click", handleClick); + }; + }, []); + + const toggleDropdown = (event: React.MouseEvent) => { + event.stopPropagation(); + setDisplay(display === "none" ? "block" : "none"); + }; + + const handleOptionClick = (button: string, event: React.MouseEvent) => { + event.stopPropagation(); + setFilter(button); + setDisplay("none"); + }; + + return ( +
+

Manage members

+ + {/* heading */} +
+ On the Free plan all members in a workspace are administrators. Upgrade + to a paid plan to add the ability to assign or remove administrator + roles. + + Go to Plans + + + + +
+ +
+
+
+ + + + +
+ +
+ + +
event.stopPropagation()} + > + {accountType_button.map((button, index) => ( + + ))} +
+
+
+ +
+ +
+
+ + +
+ ); +} + +export default MemberManagement; diff --git a/app/components/dashboard/UserList.tsx b/app/components/dashboard/UserList.tsx new file mode 100644 index 00000000..48cfb8fb --- /dev/null +++ b/app/components/dashboard/UserList.tsx @@ -0,0 +1,66 @@ +import { ChevronDown, Ellipsis } from "lucide-react"; +import { useState } from "react"; + +import DeleteMemberModal from "../ui/DeleteMemberModal"; +import { users } from "./users"; + +interface Properties { + search: string; + filter: string; +} + +const UserList: React.FC = ({ search, filter }) => { + const [isModalVisible, setIsModalVisible] = useState(false); + const [selectedUserName, setSelectedUserName] = useState(""); + // handle member delete modal + const handleMemberDelete = (userName: string): void => { + setSelectedUserName(userName); + setIsModalVisible(true); + }; + return ( + <> +

{users.length} active members

+ {users + .filter( + (user) => + user.name.toLowerCase().includes(search.toLowerCase()) || + user.email.toLowerCase().includes(search.toLowerCase()) || + user.role.toLowerCase() === filter.toLowerCase(), + ) + .map((user, index) => ( +
+
+
+
+
+

{user.name}

+

{user.email}

+
+
+

+ {user.isAdmin ? "Admin" : user.isGuest ? "Guest" : "Users"} + +

+
+ +
+ + + {isModalVisible && selectedUserName === user.name && ( +
+ +
+ )} +
+
+ ))} + + ); +}; + +export default UserList; diff --git a/app/components/dashboard/users.ts b/app/components/dashboard/users.ts new file mode 100644 index 00000000..420fae45 --- /dev/null +++ b/app/components/dashboard/users.ts @@ -0,0 +1,41 @@ +// Define the User interface +export interface User { + id: number; + name: string; + email: string; + isAdmin: boolean; + isUser: boolean; + isGuest: boolean; + role: string; +} + +// Demo users data +export const users: User[] = [ + { + id: 1, + name: "john doe", + email: "johndoe@gmail.test", + isAdmin: true, + isUser: false, + isGuest: false, + role: "members", + }, + { + id: 2, + name: "tester", + email: "johndoe@gmail.test", + isAdmin: false, + isUser: true, + isGuest: false, + role: "suspended", + }, + { + id: 3, + name: "rest2", + email: "rohndoe@gmail.test", + isAdmin: false, + isUser: true, + isGuest: false, + role: "left workspace", + }, +]; diff --git a/app/components/ui/arrow.tsx b/app/components/ui/arrow.tsx new file mode 100644 index 00000000..1eceb593 --- /dev/null +++ b/app/components/ui/arrow.tsx @@ -0,0 +1,11 @@ +export const Arrow = () => { + return ( + + + + ); +}; diff --git a/package-lock.json b/package-lock.json index 59abc5f5..707362b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -106,6 +106,7 @@ }, "node_modules/@babel/core": { "version": "7.24.9", + "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", @@ -134,6 +135,7 @@ }, "node_modules/@babel/core/node_modules/semver": { "version": "6.3.1", + "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -988,6 +990,7 @@ }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", + "dev": true, "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.3.0" @@ -1001,6 +1004,7 @@ }, "node_modules/@eslint-community/regexpp": { "version": "4.11.0", + "dev": true, "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -1008,6 +1012,7 @@ }, "node_modules/@eslint/eslintrc": { "version": "2.1.4", + "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.12.4", @@ -1029,6 +1034,7 @@ }, "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -1037,6 +1043,7 @@ }, "node_modules/@eslint/eslintrc/node_modules/globals": { "version": "13.24.0", + "dev": true, "license": "MIT", "dependencies": { "type-fest": "^0.20.2" @@ -1050,6 +1057,7 @@ }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -1060,6 +1068,7 @@ }, "node_modules/@eslint/js": { "version": "8.57.0", + "dev": true, "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1109,6 +1118,7 @@ }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", + "dev": true, "license": "Apache-2.0", "dependencies": { "@humanwhocodes/object-schema": "^2.0.2", @@ -1121,6 +1131,7 @@ }, "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -1129,6 +1140,7 @@ }, "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -1139,6 +1151,7 @@ }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=12.22" @@ -1150,6 +1163,7 @@ }, "node_modules/@humanwhocodes/object-schema": { "version": "2.0.3", + "dev": true, "license": "BSD-3-Clause" }, "node_modules/@ianvs/prettier-plugin-sort-imports": { @@ -3542,6 +3556,7 @@ }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", + "dev": true, "license": "ISC" }, "node_modules/@vanilla-extract/babel-plugin-debug-ids": { @@ -3794,6 +3809,7 @@ }, "node_modules/acorn-jsx": { "version": "5.3.2", + "dev": true, "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -3874,6 +3890,7 @@ }, "node_modules/argparse": { "version": "2.0.1", + "dev": true, "license": "Python-2.0" }, "node_modules/aria-hidden": { @@ -4065,6 +4082,7 @@ }, "node_modules/autoprefixer": { "version": "10.4.19", + "dev": true, "funding": [ { "type": "opencollective", @@ -4403,6 +4421,7 @@ }, "node_modules/callsites": { "version": "3.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -4699,6 +4718,7 @@ }, "node_modules/concat-map": { "version": "0.0.1", + "dev": true, "license": "MIT" }, "node_modules/confbox": { @@ -4992,6 +5012,7 @@ }, "node_modules/deep-is": { "version": "0.1.4", + "dev": true, "license": "MIT" }, "node_modules/deep-object-diff": { @@ -5105,6 +5126,7 @@ }, "node_modules/doctrine": { "version": "3.0.0", + "dev": true, "license": "Apache-2.0", "dependencies": { "esutils": "^2.0.2" @@ -5984,6 +6006,7 @@ }, "node_modules/escape-string-regexp": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -5994,6 +6017,7 @@ }, "node_modules/eslint": { "version": "8.57.0", + "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -6589,6 +6613,7 @@ }, "node_modules/eslint-scope": { "version": "7.2.2", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", @@ -6603,6 +6628,7 @@ }, "node_modules/eslint-visitor-keys": { "version": "3.4.3", + "dev": true, "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -6613,6 +6639,7 @@ }, "node_modules/eslint/node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -6621,6 +6648,7 @@ }, "node_modules/eslint/node_modules/glob-parent": { "version": "6.0.2", + "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.3" @@ -6631,6 +6659,7 @@ }, "node_modules/eslint/node_modules/globals": { "version": "13.24.0", + "dev": true, "license": "MIT", "dependencies": { "type-fest": "^0.20.2" @@ -6644,6 +6673,7 @@ }, "node_modules/eslint/node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -6654,6 +6684,7 @@ }, "node_modules/espree": { "version": "9.6.1", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "acorn": "^8.9.0", @@ -6669,6 +6700,7 @@ }, "node_modules/esquery": { "version": "1.6.0", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" @@ -6777,6 +6809,7 @@ }, "node_modules/esutils": { "version": "2.0.3", + "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" @@ -6956,6 +6989,7 @@ }, "node_modules/fast-levenshtein": { "version": "2.0.6", + "dev": true, "license": "MIT" }, "node_modules/fastq": { @@ -6979,6 +7013,7 @@ }, "node_modules/file-entry-cache": { "version": "6.0.1", + "dev": true, "license": "MIT", "dependencies": { "flat-cache": "^3.0.4" @@ -7026,6 +7061,7 @@ }, "node_modules/find-up": { "version": "5.0.0", + "dev": true, "license": "MIT", "dependencies": { "locate-path": "^6.0.0", @@ -7040,6 +7076,7 @@ }, "node_modules/flat-cache": { "version": "3.2.0", + "dev": true, "license": "MIT", "dependencies": { "flatted": "^3.2.9", @@ -7052,6 +7089,7 @@ }, "node_modules/flatted": { "version": "3.3.1", + "dev": true, "license": "ISC" }, "node_modules/for-each": { @@ -7171,6 +7209,7 @@ }, "node_modules/fs.realpath": { "version": "1.0.0", + "dev": true, "license": "ISC" }, "node_modules/fsevents": { @@ -7402,6 +7441,7 @@ }, "node_modules/graphemer": { "version": "1.4.0", + "dev": true, "license": "MIT" }, "node_modules/gunzip-maybe": { @@ -7638,6 +7678,7 @@ }, "node_modules/ignore": { "version": "5.3.1", + "dev": true, "license": "MIT", "engines": { "node": ">= 4" @@ -7645,6 +7686,7 @@ }, "node_modules/import-fresh": { "version": "3.3.0", + "dev": true, "license": "MIT", "dependencies": { "parent-module": "^1.0.0", @@ -7659,6 +7701,7 @@ }, "node_modules/imurmurhash": { "version": "0.1.4", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.19" @@ -7674,6 +7717,7 @@ }, "node_modules/inflight": { "version": "1.0.6", + "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -8048,6 +8092,7 @@ }, "node_modules/is-path-inside": { "version": "3.0.3", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -8325,6 +8370,7 @@ }, "node_modules/js-yaml": { "version": "4.1.0", + "dev": true, "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -8346,6 +8392,7 @@ }, "node_modules/json-buffer": { "version": "3.0.1", + "dev": true, "license": "MIT" }, "node_modules/json-parse-even-better-errors": { @@ -8362,6 +8409,7 @@ }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", + "dev": true, "license": "MIT" }, "node_modules/json5": { @@ -8401,6 +8449,7 @@ }, "node_modules/keyv": { "version": "4.5.4", + "dev": true, "license": "MIT", "dependencies": { "json-buffer": "3.0.1" @@ -8440,6 +8489,7 @@ }, "node_modules/levn": { "version": "0.4.1", + "dev": true, "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1", @@ -8496,6 +8546,7 @@ }, "node_modules/locate-path": { "version": "6.0.0", + "dev": true, "license": "MIT", "dependencies": { "p-locate": "^5.0.0" @@ -8523,6 +8574,7 @@ }, "node_modules/lodash.merge": { "version": "4.6.2", + "dev": true, "license": "MIT" }, "node_modules/log-symbols": { @@ -9718,6 +9770,7 @@ }, "node_modules/natural-compare": { "version": "1.4.0", + "dev": true, "license": "MIT" }, "node_modules/negotiator": { @@ -10050,6 +10103,7 @@ }, "node_modules/once": { "version": "1.4.0", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -10070,6 +10124,7 @@ }, "node_modules/optionator": { "version": "0.9.4", + "dev": true, "license": "MIT", "dependencies": { "deep-is": "^0.1.3", @@ -10111,6 +10166,7 @@ }, "node_modules/p-limit": { "version": "3.1.0", + "dev": true, "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" @@ -10124,6 +10180,7 @@ }, "node_modules/p-locate": { "version": "5.0.0", + "dev": true, "license": "MIT", "dependencies": { "p-limit": "^3.0.2" @@ -10169,6 +10226,7 @@ }, "node_modules/parent-module": { "version": "1.0.1", + "dev": true, "license": "MIT", "dependencies": { "callsites": "^3.0.0" @@ -10249,6 +10307,7 @@ }, "node_modules/path-exists": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -10256,6 +10315,7 @@ }, "node_modules/path-is-absolute": { "version": "1.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -10403,6 +10463,7 @@ }, "node_modules/postcss": { "version": "8.4.39", + "dev": true, "funding": [ { "type": "opencollective", @@ -10610,6 +10671,7 @@ }, "node_modules/prelude-ls": { "version": "1.2.1", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.8.0" @@ -11813,6 +11875,7 @@ }, "node_modules/resolve-from": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -11863,6 +11926,7 @@ }, "node_modules/rimraf": { "version": "3.0.2", + "dev": true, "license": "ISC", "dependencies": { "glob": "^7.1.3" @@ -11876,6 +11940,7 @@ }, "node_modules/rimraf/node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -11884,6 +11949,7 @@ }, "node_modules/rimraf/node_modules/glob": { "version": "7.2.3", + "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -11902,6 +11968,7 @@ }, "node_modules/rimraf/node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -12653,6 +12720,7 @@ }, "node_modules/strip-json-comments": { "version": "3.1.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -12775,6 +12843,7 @@ }, "node_modules/tailwindcss": { "version": "3.4.6", + "dev": true, "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", @@ -12817,6 +12886,7 @@ }, "node_modules/tailwindcss/node_modules/glob-parent": { "version": "6.0.2", + "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.3" @@ -12827,6 +12897,7 @@ }, "node_modules/tailwindcss/node_modules/lilconfig": { "version": "2.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -12987,6 +13058,7 @@ }, "node_modules/text-table": { "version": "0.2.0", + "dev": true, "license": "MIT" }, "node_modules/thenify": { @@ -13148,6 +13220,7 @@ }, "node_modules/type-check": { "version": "0.4.0", + "dev": true, "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1" @@ -13158,6 +13231,7 @@ }, "node_modules/type-fest": { "version": "0.20.2", + "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" @@ -13248,7 +13322,7 @@ }, "node_modules/typescript": { "version": "5.5.3", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -14320,6 +14394,7 @@ }, "node_modules/word-wrap": { "version": "1.2.5", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -14407,6 +14482,7 @@ }, "node_modules/wrappy": { "version": "1.0.2", + "dev": true, "license": "ISC" }, "node_modules/ws": { @@ -14461,6 +14537,7 @@ }, "node_modules/yocto-queue": { "version": "0.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -14487,4 +14564,4 @@ } } } -} \ No newline at end of file +}