-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refactor/refactor-base' into refactor/projects-modal
- Loading branch information
Showing
15 changed files
with
103 additions
and
33 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
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 |
---|---|---|
@@ -1,19 +1,41 @@ | ||
import {createApi, fetchBaseQuery} from '@reduxjs/toolkit/query/react'; | ||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; | ||
import initialState from '@/store/slices/app/app.initialstate'; // Ensure this path is correct | ||
|
||
const projectsTag: string = 'projects'; | ||
const organizationsTag: string = 'organizations'; | ||
const unitsTag: string = 'projects'; | ||
const auditTag: string = 'audit'; | ||
const projectsTag = 'projects'; | ||
const organizationsTag = 'organizations'; | ||
const unitsTag = 'projects'; | ||
const auditTag = 'audit'; | ||
|
||
const baseQuery = fetchBaseQuery({ | ||
baseUrl: '/', | ||
}); | ||
|
||
export { projectsTag, organizationsTag, unitsTag, auditTag}; | ||
const baseQueryWithDynamicHost = async (args, api, extraOptions) => { | ||
let modifiedArgs = args; | ||
const state = api.getState(); | ||
const currentHost = state.app.apiHost; | ||
|
||
// Check if currentHost is equal to the initialState's apiHost | ||
const effectiveHost = (currentHost === initialState.apiHost && import.meta.env.VITE_API_HOST) ? import.meta.env.VITE_API_HOST : currentHost; | ||
|
||
// Modify the URL based on the effectiveHost | ||
if (typeof args === 'string') { | ||
modifiedArgs = `${effectiveHost}${args}`; | ||
} else if (args && typeof args === 'object') { | ||
modifiedArgs = { | ||
...args, | ||
url: `${effectiveHost}${args.url}`, | ||
}; | ||
} | ||
|
||
return await baseQuery(modifiedArgs, api, extraOptions); | ||
}; | ||
|
||
export const cadtApi = createApi({ | ||
baseQuery, | ||
baseQuery: baseQueryWithDynamicHost, | ||
reducerPath: 'cadtApi', | ||
tagTypes: [projectsTag, organizationsTag, unitsTag, auditTag], | ||
endpoints: () => ({}), | ||
}); | ||
|
||
export { projectsTag, organizationsTag, unitsTag, auditTag }; |
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,33 @@ | ||
import React from 'react'; | ||
|
||
interface WarehouseIconProps { | ||
width: number | string | undefined; | ||
height: number | string | undefined; | ||
} | ||
|
||
const WarehouseIcon: React.FC<WarehouseIconProps> = ({ width, height }: WarehouseIconProps) => { | ||
return ( | ||
<svg | ||
width={`${width}px`} | ||
height={`${height}px`} | ||
viewBox="0 0 22 18" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M15.5 7.45312H6.49998C6.39685 7.45312 6.31248 7.5375 6.31248 7.64062V17.0625C6.31248 17.1656 6.39685 17.25 6.49998 17.25H15.5C15.6031 17.25 15.6875 17.1656 15.6875 17.0625V7.64062C15.6875 7.5375 15.6031 7.45312 15.5 7.45312ZM7.81248 8.95312H14.1875V11.6953H7.81248V8.95312ZM14.1875 15.75H7.81248V13.0078H14.1875V15.75Z" | ||
fill="currentColor" | ||
/> | ||
<path | ||
d="M8.93748 14.5312C8.93748 14.7302 9.01649 14.9209 9.15715 15.0616C9.2978 15.2022 9.48856 15.2812 9.68748 15.2812C9.88639 15.2812 10.0772 15.2022 10.2178 15.0616C10.3585 14.9209 10.4375 14.7302 10.4375 14.5312C10.4375 14.3323 10.3585 14.1416 10.2178 14.0009C10.0772 13.8603 9.88639 13.7812 9.68748 13.7812C9.48856 13.7812 9.2978 13.8603 9.15715 14.0009C9.01649 14.1416 8.93748 14.3323 8.93748 14.5312ZM8.93748 10.3594C8.93748 10.5583 9.01649 10.7491 9.15715 10.8897C9.2978 11.0304 9.48856 11.1094 9.68748 11.1094C9.88639 11.1094 10.0772 11.0304 10.2178 10.8897C10.3585 10.7491 10.4375 10.5583 10.4375 10.3594C10.4375 10.1605 10.3585 9.9697 10.2178 9.82904C10.0772 9.68839 9.88639 9.60938 9.68748 9.60938C9.48856 9.60938 9.2978 9.68839 9.15715 9.82904C9.01649 9.9697 8.93748 10.1605 8.93748 10.3594Z" | ||
fill="currentColor" | ||
/> | ||
<path | ||
d="M18.0181 5.64609C16.9447 2.8125 14.2095 0.796875 11.0056 0.796875C7.8017 0.796875 5.06655 2.81016 3.99311 5.64375C1.97514 6.17578 0.489205 8.02031 0.500923 10.2094C0.514986 12.6562 2.41342 14.6461 4.80405 14.8594C4.9142 14.8687 5.00795 14.782 5.00795 14.6719V13.2562C5.00795 13.1625 4.93764 13.0828 4.84389 13.0711C4.21108 12.9914 3.61342 12.7148 3.15405 12.2625C2.59155 11.7117 2.28217 10.9711 2.28217 10.1859C2.28217 9.52969 2.49545 8.91094 2.89624 8.39531C3.28764 7.89375 3.83842 7.53047 4.44545 7.37109L5.33374 7.13672L5.65952 6.27656C5.86108 5.74219 6.14233 5.24062 6.49624 4.78828C6.84545 4.33828 7.2603 3.94453 7.72436 3.61641C8.68764 2.93906 9.82202 2.58047 11.0056 2.58047C12.1892 2.58047 13.3236 2.93906 14.2869 3.61875C14.7533 3.94687 15.1658 4.34062 15.515 4.79062C15.8689 5.24297 16.1501 5.74453 16.3517 6.27891L16.6751 7.13672L17.5611 7.37109C18.8314 7.70859 19.7197 8.86406 19.7197 10.1836C19.7197 10.9711 19.4103 11.7094 18.8478 12.2602C18.3908 12.7102 17.7955 12.9891 17.1626 13.0687C17.0689 13.0805 17.0009 13.1602 17.0009 13.2539V14.6719C17.0009 14.782 17.097 14.8687 17.2072 14.8594C19.5908 14.6437 21.4845 12.6562 21.5009 10.2141C21.515 8.025 20.0314 6.18047 18.0181 5.64609Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export { WarehouseIcon }; |
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 +1,2 @@ | ||
export * from './AppLogo'; | ||
export * from './AppLogo'; | ||
export * from './WarehouseIcon'; |
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,9 @@ | ||
import {Card as FlowbiteCard, CardProps} from 'flowbite-react'; | ||
|
||
function Card({ children, ...props }: CardProps) { | ||
return ( | ||
<FlowbiteCard {...props}>{children}</FlowbiteCard> | ||
); | ||
} | ||
|
||
export {Card}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export default { | ||
locale: null, | ||
apiHost: 'http://localhost:31310' | ||
}; |
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