Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed create organization modal issue with scroll #14

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Authentication/VerifyEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { AxiosResponse } from 'axios';
import { HiOutlineMail } from "react-icons/hi";
import { apiStatusCodes } from '../../config/CommonConstant';

const VarifyEmail = () => {
const VerifyEmail = () => {
const [loading, setLoading] = useState<boolean>(true)
const [message, setMessage] = useState<string>('')
const [error, setError] = useState<boolean>(false)
Expand Down Expand Up @@ -71,4 +71,4 @@ const VarifyEmail = () => {
)
}

export default VarifyEmail
export default VerifyEmail
15 changes: 13 additions & 2 deletions src/components/organization/CreateOrgFormModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Avatar, Button, Label, Modal } from 'flowbite-react';
import { Field, Form, Formik, FormikHelpers } from 'formik';
import { IMG_MAX_HEIGHT, IMG_MAX_WIDTH, apiStatusCodes, imageSizeAccepted } from '../../config/CommonConstant'
import { calculateSize, dataURItoBlob } from "../../utils/CompressImage";
import { useRef, useState } from "react";
import { useRef, useState, useEffect } from "react";

import type { AxiosResponse } from 'axios';
import { asset } from '../../lib/data.js';
Expand Down Expand Up @@ -40,6 +40,17 @@ const CreateOrgFormModal = (props: { openModal: boolean; setOpenModal: (flag: bo

const [imgError, setImgError] = useState('')

useEffect(()=>{
setOrgData({
name: '',
description: '',
})
setLogoImage({
logoFile: "",
imagePreviewUrl: ""
})
},[props.openModal])


const ProcessImg = (e: any): string | undefined => {

Expand Down Expand Up @@ -141,7 +152,7 @@ const CreateOrgFormModal = (props: { openModal: boolean; setOpenModal: (flag: bo
}

return (
<Modal show={props.openModal === true} onClose={() => {
<Modal show={props.openModal} onClose={() => {
setLogoImage({
logoFile: "",
imagePreviewUrl: ""
Expand Down
6 changes: 1 addition & 5 deletions src/components/organization/OrganizationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,11 @@ const OrganizationsList = () => {
</Button>
</div>

{
props.openModal &&
<CreateOrgFormModal
<CreateOrgFormModal
openModal={props.openModal}
setOpenModal={
props.setOpenModal
} />
}

{loading
? <div className="flex items-center justify-center mb-4">
<Spinner
Expand Down
58 changes: 58 additions & 0 deletions src/components/organization/Users.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use client';

import { Button, Card, Pagination, Spinner } from 'flowbite-react';
import { ChangeEvent, useEffect, useState } from 'react';

import type { AxiosResponse } from 'axios';
import BreadCrumbs from '../BreadCrumbs';
import CreateOrgFormModal from "./CreateOrgFormModal";
import CustomAvatar from '../Avatar'
import type { Organisation } from './interfaces'
import SearchInput from '../SearchInput';

const Users = () => {
const [openModal, setOpenModal] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(true)
const [message, setMessage] = useState<string>('')


const [searchText, setSearchText] = useState("");
const props = { openModal, setOpenModal };



//onCHnage of Search input text
const searchInputChange = (e: ChangeEvent<HTMLInputElement>) => {
setSearchText(e.target.value);
}


return (
<div className="px-4 pt-6">
<div className="mb-4 col-span-full xl:mb-2">

<BreadCrumbs />
<h1 className="ml-1 text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white">
Users
</h1>
</div>
<div>
<div className="p-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
<div className="flex items-center justify-between mb-4">
<SearchInput
onInputChange={searchInputChange}
/>
<Button
color='bg-primary-800'
className='text-base font-medium text-center text-white bg-primary-700 rounded-lg hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 sm:w-auto dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"'
>
Invite
</Button>
</div>
</div>
</div>
</div>
)
}

export default Users;
8 changes: 8 additions & 0 deletions src/pages/organizations/users.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
import LayoutSidebar from '../../app/LayoutSidebar.astro';
import Users from '../../components/organization/Users';
---

<LayoutSidebar>
<Users client:load/>
</LayoutSidebar>
4 changes: 2 additions & 2 deletions src/pages/verify-email-success.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import LayoutStacked from '../app/LayoutStacked.astro';
import VarifyEmail from '../components/Authentication/VerifyEmail';
import VerifyEmail from '../components/Authentication/VerifyEmail';
---

<LayoutStacked>
<VarifyEmail client:load/>
<VerifyEmail client:load/>
</LayoutStacked>