diff --git a/src/App.tsx b/src/App.tsx index c3f465b..f9b3992 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,16 +4,22 @@ import { Outlet } from "react-router-dom"; import { useGetAccountQuery } from "store/apis/profile"; import { config } from "config"; import { useEffect } from "react"; +import { useTheme } from "components/utils/useTheme"; const { supportedLocales, realm } = config.env; function App() { const hasLocale = (locale: string): boolean => locale in supportedLocales; + // Triggers theme without having to open theme menu + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const themes = useTheme(); + const { data: account } = useGetAccountQuery({ userProfileMetadata: true, realm, }); + useEffect(() => { // load language (after login) if ( diff --git a/src/components/elements/forms/buttons/button.tsx b/src/components/elements/forms/buttons/button.tsx index c534fe2..9987a59 100644 --- a/src/components/elements/forms/buttons/button.tsx +++ b/src/components/elements/forms/buttons/button.tsx @@ -31,7 +31,7 @@ const Button: FC = ({
= ({ = ({ id={slug} className={cs( BasicFormClasses, - "block w-full rounded-md border-gray-300 focus:border-transparent focus:ring-[#134FC2] sm:text-sm" + "block w-full rounded-md border-gray-300 focus:border-transparent focus:ring-primary-700 sm:text-sm" )} placeholder="placeholder" {...inputArgs} diff --git a/src/components/elements/forms/inputs/text-input.tsx b/src/components/elements/forms/inputs/text-input.tsx index d3eb097..cfde446 100644 --- a/src/components/elements/forms/inputs/text-input.tsx +++ b/src/components/elements/forms/inputs/text-input.tsx @@ -1,5 +1,5 @@ export const BasicFormClasses = - "block rounded border-gray-300 dark:border-zinc-600 dark:text-zinc-200 sm:text-sm bg-white dark:bg-p2dark-1000 disabled:opacity-50 disabled:cursor-not-allowed hover:border-gray-500 transition"; + "block rounded-md border-gray-300 border-gray-300 bg-white transition hover:border-gray-500 focus:border-transparent focus:ring-primary-700 disabled:cursor-not-allowed disabled:opacity-50 dark:border-zinc-600 dark:bg-p2dark-1000 dark:text-zinc-200 sm:text-sm"; const FormTextInput = () => { return ( diff --git a/src/components/elements/organizations/item.tsx b/src/components/elements/organizations/item.tsx index 3d192c9..51d0064 100644 --- a/src/components/elements/organizations/item.tsx +++ b/src/components/elements/organizations/item.tsx @@ -15,7 +15,9 @@ type Props = { }; const Title = ({ children }) => ( -
{children}
+
+ {children} +
); const SubTitle = ({ children }) => (
{children}
@@ -40,13 +42,16 @@ const InnerItem = ({
diff --git a/src/components/elements/rounded-icon.tsx b/src/components/elements/rounded-icon.tsx index 5f972ea..4457709 100644 --- a/src/components/elements/rounded-icon.tsx +++ b/src/components/elements/rounded-icon.tsx @@ -10,7 +10,7 @@ const RoundedIcon: FC = ({ children, className }) => { return (
-
+
{children}
diff --git a/src/components/elements/table/table.tsx b/src/components/elements/table/table.tsx index 3c59663..f570910 100644 --- a/src/components/elements/table/table.tsx +++ b/src/components/elements/table/table.tsx @@ -57,7 +57,11 @@ const Table: React.FC = ({ columns, rows, isLoading, emptyState }) => { return loadingState(columns); } if (rows.length === 0 && emptyState) { - return
{emptyState}
; + return ( +
+ {emptyState} +
+ ); } return (
diff --git a/src/components/navs/desktop-sidebar-nav.tsx b/src/components/navs/desktop-sidebar-nav.tsx index 1b97598..ec7119a 100644 --- a/src/components/navs/desktop-sidebar-nav.tsx +++ b/src/components/navs/desktop-sidebar-nav.tsx @@ -93,10 +93,12 @@ const DesktopSidebarNav: React.FC = ({ "group flex items-center rounded-lg border-2 border-gray-200 p-[14px] text-sm transition-colors hover:border-gray-300 hover:bg-white dark:hover:border-zinc-600 dark:hover:bg-p2dark-900", { "dark:border-zinc-600 dark:text-white": !isActive, - "group:text-primary-700 border-primary-700 bg-white text-primary-700 dark:bg-p2dark-900": + "group:text-primary-700 border-primary-700 bg-white text-primary-700": + isActive, + "dark:border-zinc-400 dark:bg-p2dark-900 dark:text-white": isActive, "w-full border-0": !menuCollapsed, - "border-primary-700 text-primary-700 hover:border-primary-700 dark:hover:border-primary-700 dark:hover:bg-p2dark-900": + "border-primary-700 text-primary-700 hover:border-primary-700 dark:hover:bg-p2dark-900": menuCollapsed && isActive, } ) @@ -121,7 +123,7 @@ const DesktopSidebarNav: React.FC = ({
-
+
{fullName().substring(0, 1)}
{!menuCollapsed && ( diff --git a/src/components/utils/fullName.tsx b/src/components/utils/fullName.tsx index f35b09a..48bb2c8 100644 --- a/src/components/utils/fullName.tsx +++ b/src/components/utils/fullName.tsx @@ -1,6 +1,9 @@ import { UserRepresentation } from "store/apis/orgs"; export default function fullName(member: UserRepresentation) { - const name = `${member.firstName} ${member.lastName}`.trim(); - return name === "" ? null : name; + let name = `${member.firstName} ${member.lastName}`.trim(); + if (name) { + return name; + } + return member.email; } diff --git a/src/components/utils/injectStyles.tsx b/src/components/utils/injectStyles.tsx index 89b2580..f75e4a5 100644 --- a/src/components/utils/injectStyles.tsx +++ b/src/components/utils/injectStyles.tsx @@ -4,13 +4,61 @@ import { config } from "config"; function generateColorStyles(colorName: string, colorValue?: string) { return colorValue ? `.text-${colorName} { color: ${colorValue}; } - .bg-${colorName} { background-color: ${colorValue}; }` + .bg-${colorName} { background-color: ${colorValue}; } + .border-${colorName} { border-color: ${colorValue}; } + .from-${colorName} { --tw-gradient-from: ${colorValue}; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, ${colorValue}); } + .via-${colorName} { --tw-gradient-stops: var(--tw-gradient-from), ${colorValue}, var(--tw-gradient-to, ${colorValue}); } + .to-${colorName} { --tw-gradient-to: ${colorValue}; } + .placeholder-${colorName} { color: ${colorValue}; opacity: 1; } + .ring-${colorName} { --tw-ring-color: ${colorValue}; } + .divide-${colorName} { border-color: ${colorValue}; } + .hover\\:text-${colorName}:hover { color: ${colorValue}; } + .hover\\:bg-${colorName}:hover { background-color: ${colorValue}; } + .hover\\:border-${colorName}:hover { border-color: ${colorValue}; } + .hover\\:ring-${colorName}:hover { --tw-ring-color: ${colorValue}; } + .focus\\:text-${colorName}:focus { color: ${colorValue}; } + .focus\\:bg-${colorName}:focus { background-color: ${colorValue}; } + .focus\\:border-${colorName}:focus { border-color: ${colorValue}; } + .focus\\:ring-${colorName}:focus { --tw-ring-color: ${colorValue}; } + .active\\:text-${colorName}:active { color: ${colorValue}; } + .active\\:bg-${colorName}:active { background-color: ${colorValue}; } + .active\\:border-${colorName}:active { border-color: ${colorValue}; } + .active\\:ring-${colorName}:active { --tw-ring-color: ${colorValue}; } + .group:hover .group-hover\\:text-${colorName} { color: ${colorValue}; } + .group:hover .group-hover\\:bg-${colorName} { background-color: ${colorValue}; } + .group:hover .group-hover\\:border-${colorName} { border-color: ${colorValue}; } + .group:hover .group-hover\\:ring-${colorName} { --tw-ring-color: ${colorValue}; } + .group:focus .group-focus\\:text-${colorName} { color: ${colorValue}; } + .group:focus .group-focus\\:bg-${colorName} { background-color: ${colorValue}; } + .group:focus .group-focus\\:border-${colorName} { border-color: ${colorValue}; } + .group:focus .group-focus\\:ring-${colorName} { --tw-ring-color: ${colorValue}; } + .group:active .group-active\\:text-${colorName} { color: ${colorValue}; } + .group:active .group-active\\:bg-${colorName} { background-color: ${colorValue}; } + .group:active .group-active\\:border-${colorName} { border-color: ${colorValue}; } + .group:active .group-active\\:ring-${colorName} { --tw-ring-color: ${colorValue}; } + .group:enabled .group-enabled\\:text-${colorName} { color: ${colorValue}; } + .group:enabled .group-enabled\\:bg-${colorName} { background-color: ${colorValue}; } + .group:enabled .group-enabled\\:border-${colorName} { border-color: ${colorValue}; } + .group:enabled .group-enabled\\:ring-${colorName} { --tw-ring-color: ${colorValue}; } + .group:enabled:hover .group-enabled\\:group-hover\\:text-${colorName} { color: ${colorValue}; } + .group:enabled:hover .group-enabled\\:group-hover\\:bg-${colorName} { background-color: ${colorValue}; } + .group:enabled:hover .group-enabled\\:group-hover\\:border-${colorName} { border-color: ${colorValue}; } + .group:enabled:hover .group-enabled\\:group-hover\\:ring-${colorName} { --tw-ring-color: ${colorValue}; } + ` + : ""; +} + +function generateButtonStyles(cv1?: string, cv2?: string) { + return cv1 && cv2 + ? `.bg-primary-gradient { + background-image: linear-gradient(to right, ${cv1}, ${cv2}); + }` : ""; } const InjectStyles = () => { useEffect(() => { - const { styles = { customCSS: "" } } = config.env; + const { styles } = config.env; const styleElement = document.createElement("style"); const primaryColor = ` @@ -21,6 +69,7 @@ const InjectStyles = () => { ${generateColorStyles("primary-600", styles.primary600)} ${generateColorStyles("primary-700", styles.primary700)} ${generateColorStyles("primary-900", styles.primary900)} + ${generateButtonStyles(styles.primary100, styles.primary600)} `; const secondaryColor = ` diff --git a/src/index.css b/src/index.css index 5ec6a8f..8631970 100644 --- a/src/index.css +++ b/src/index.css @@ -10,16 +10,6 @@ @apply antialiased; } - .loading-animate { - @apply bg-[conic-gradient(from_0deg,var(--tw-gradient-stops))]; - @apply from-[#C7DFF0]/0; - @apply to-[#1476B7]; - - -webkit-animation: LoadingAnimation 1.5s linear infinite; - -moz-animation: LoadingAnimation 1.5s linear infinite; - animation: LoadingAnimation 1.5s linear infinite; - } - @keyframes LoadingAnimation { 0% { transform: rotate(0deg); diff --git a/src/pages/invitation/new.tsx b/src/pages/invitation/new.tsx index d6d0636..8187638 100644 --- a/src/pages/invitation/new.tsx +++ b/src/pages/invitation/new.tsx @@ -23,7 +23,7 @@ const { realm } = config.env; const loadingIcon = (
-
+
diff --git a/src/pages/member/components/loading-icon.tsx b/src/pages/member/components/loading-icon.tsx index 8aa275e..d3c83c3 100644 --- a/src/pages/member/components/loading-icon.tsx +++ b/src/pages/member/components/loading-icon.tsx @@ -3,7 +3,7 @@ import { User } from "lucide-react"; export const LoadingIcon = (
-
+
diff --git a/src/pages/organizations/detail.tsx b/src/pages/organizations/detail.tsx index 586b98f..3593e22 100644 --- a/src/pages/organizations/detail.tsx +++ b/src/pages/organizations/detail.tsx @@ -286,7 +286,7 @@ export default function OrganizationDetail() {