-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: members and improvements (#43)
- Loading branch information
1 parent
e5741cc
commit b098210
Showing
26 changed files
with
504 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
NEXT_PUBLIC_ARKE_SERVER_URL=http://0.0.0.0:4000 | ||
NEXT_MULTIPROJECT=false | ||
NEXT_MULTIPROJECT=true | ||
NEXTAUTH_URL=http://localhost:3100/api/auth | ||
NEXTAUTH_SECRET=your_secret | ||
NEXT_PUBLIC_ARKE_PROJECT="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Copyright 2023 Arkemis S.r.l. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { | ||
EyeIcon, | ||
EyeSlashIcon, | ||
LockClosedIcon, | ||
} from "@heroicons/react/24/outline"; | ||
import { Input } from "@arkejs/ui"; | ||
import React, { useState } from "react"; | ||
|
||
interface InputPasswordProps { | ||
value: string; | ||
onChange(e: React.ChangeEvent<HTMLInputElement>): void; | ||
} | ||
|
||
export default function InputPassword(props: InputPasswordProps) { | ||
const [showPassword, setShowPassword] = useState<boolean>(false); | ||
const { value, onChange } = props; | ||
return ( | ||
<Input | ||
autoComplete="new-password" | ||
value={value} | ||
type={!showPassword ? "password" : "text"} | ||
onChange={onChange} | ||
placeholder="Password" | ||
fullWidth | ||
startAdornment={<LockClosedIcon className="h-5 w-5 stroke-white/50" />} | ||
endAdornment={ | ||
<span | ||
role="presentation" | ||
onClick={() => setShowPassword(!showPassword)} | ||
> | ||
{!showPassword ? ( | ||
<EyeIcon className="h-5 w-5 stroke-white/50" /> | ||
) : ( | ||
<EyeSlashIcon className="h-5 w-5 stroke-white/50" /> | ||
)} | ||
</span> | ||
} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2024 Arkemis S.r.l. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Autocomplete } from "@arkejs/ui"; | ||
import { TUnit } from "@arkejs/client"; | ||
import React, { useEffect, useState } from "react"; | ||
import useDebounce from "@/hooks/useDebounce"; | ||
import useClient from "@/arke/useClient"; | ||
|
||
export default function UnitSearch({ | ||
arke, | ||
value, | ||
onChange, | ||
placeholder, | ||
label, | ||
config, | ||
renderValue, | ||
renderOption, | ||
}: { | ||
arke: string; | ||
value: TUnit; | ||
onChange: (value: TUnit) => void; | ||
label?: string; | ||
placeholder?: string; | ||
config?(searchedText: string): any; | ||
renderValue?(val: TUnit): any; | ||
renderOption?(val: TUnit): any; | ||
}) { | ||
const client = useClient(); | ||
const [inputValue, setInputValue] = useState(""); | ||
const [values, setValues] = useState<TUnit[]>([]); | ||
const debouncedInputValue = useDebounce<string>(inputValue, 500); | ||
|
||
useEffect(() => { | ||
if (debouncedInputValue) { | ||
client.unit.getAll(arke, config?.(debouncedInputValue)).then((res) => { | ||
setValues(res.data.content.items); | ||
}); | ||
} | ||
}, [debouncedInputValue]); | ||
|
||
return ( | ||
<Autocomplete | ||
label={label} | ||
onChange={onChange} | ||
onInputChange={(event) => setInputValue(event.target.value)} | ||
values={values} | ||
value={value} | ||
renderChips={false} | ||
placeholder={placeholder || "Search an unit"} | ||
renderValue={(value) => | ||
renderValue?.(value) ?? (value as TUnit).label ?? (value as TUnit).id | ||
} | ||
renderOption={renderOption} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.