feat(core, react): add BeforeNavigation and AfterNavigation for testing
This commit is contained in:
parent
1ec73bbb22
commit
c3afe67e8f
5 changed files with 52 additions and 18 deletions
41
blueprint.sh
41
blueprint.sh
|
@ -586,29 +586,38 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y"
|
||||||
|
|
||||||
log_bright "[INFO] Placing components directory contents.."
|
log_bright "[INFO] Placing components directory contents.."
|
||||||
cp -R ".blueprint/tmp/$n/$dashboard_components/"* ".blueprint/extensions/$identifier/components/" 2>> $BLUEPRINT__DEBUG
|
cp -R ".blueprint/tmp/$n/$dashboard_components/"* ".blueprint/extensions/$identifier/components/" 2>> $BLUEPRINT__DEBUG
|
||||||
if [[ -f ".blueprint/tmp/$n/$dashboard_components/components.yml" ]]; then
|
if [[ -f ".blueprint/tmp/$n/$dashboard_components/Components.yml" ]]; then
|
||||||
|
|
||||||
# fetch component config
|
# fetch component config
|
||||||
eval "$(parse_yaml .blueprint/tmp/"$n"/"$dashboard_components"/components.yml comp_)"
|
eval "$(parse_yaml .blueprint/tmp/"$n"/"$dashboard_components"/Components.yml Components_)"
|
||||||
|
|
||||||
|
# define static variables to make stuff a bit easier
|
||||||
|
im="\/\* blueprint\/import \*\/"; re="{/\* blueprint\/react \*/}"; co="resources/scripts/blueprint/components"
|
||||||
|
s="import ${identifier^}Component from '"; e="';"
|
||||||
|
|
||||||
|
PLACE_REACT() {
|
||||||
|
if [[ ! $1 == "@/blueprint/extensions/${identifier}/" ]]; then
|
||||||
|
# remove components
|
||||||
|
sed -i "s~""${s}$1${e}""~~g" "$co"/"$2"
|
||||||
|
sed -i "s~""<${identifier^}Component />""~~g" "$co"/"$2"
|
||||||
|
# add components
|
||||||
|
sed -i "s~""$im""~""${im}${s}$1${e}""~g" "$co"/"$2"
|
||||||
|
sed -i "s~""$re""~""${re}\<${identifier^}Component /\>""~g" "$co"/"$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# assign variables to component items
|
# assign variables to component items
|
||||||
extendNavigationBarItems="@/blueprint/extensions/${identifier}/${comp_extendNavigationBarItems}"
|
__Navigation_NavigationBar_BeforeNavigation="@/blueprint/extensions/${identifier}/${Components_Navigation_NavigationBar_BeforeNavigation}"
|
||||||
|
__Navigation_NavigationBar_AdditionalItems="@/blueprint/extensions/${identifier}/${Components_Navigation_NavigationBar_AdditionalItems}"
|
||||||
|
__Navigation_NavigationBar_AfterNavigation="@/blueprint/extensions/${identifier}/${Components_Navigation_NavigationBar_AfterNavigation}"
|
||||||
|
|
||||||
im="\/\* blueprint\/import \*\/"
|
PLACE_REACT "$__Navigation_NavigationBar_BeforeNavigation" "Navigation/NavigationBar/BeforeNavigation.tsx"
|
||||||
re="{/\* blueprint\/react \*/}"
|
PLACE_REACT "$__Navigation_NavigationBar_AdditionalItems" "Navigation/NavigationBar/AdditionalItems.tsx"
|
||||||
co="resources/scripts/blueprint/components"
|
PLACE_REACT "$__Navigation_NavigationBar_AfterNavigation" "Navigation/NavigationBar/AfterNavigation.tsx"
|
||||||
|
|
||||||
s="import ${identifier^}Component from '"
|
|
||||||
e="';"
|
|
||||||
|
|
||||||
sed -i "s~""${s}$extendNavigationBarItems${e}""~~g" $co/NavigationBar/Items.tsx
|
|
||||||
sed -i "s~""<${identifier^}Component />""~~g" $co/NavigationBar/Items.tsx
|
|
||||||
|
|
||||||
sed -i "s~""$im""~""${im}${s}$extendNavigationBarItems${e}""~g" $co/NavigationBar/Items.tsx
|
|
||||||
sed -i "s~""$re""~""${re}\<${identifier^}Component /\>""~g" $co/NavigationBar/Items.tsx
|
|
||||||
|
|
||||||
else
|
else
|
||||||
# warn about missing components.yml file
|
# warn about missing components.yml file
|
||||||
log_yellow "[WARNING] Could not find '$dashboard_components/components.yml', React component extendability might be limited."
|
log_yellow "[WARNING] Could not find '$dashboard_components/Components.yml', React component extendability might be limited."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import React from 'react';
|
||||||
|
/* blueprint/import */
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* blueprint/react */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,10 @@
|
||||||
|
import React from 'react';
|
||||||
|
/* blueprint/import */
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* blueprint/react */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
|
@ -12,7 +12,10 @@ import http from '@/api/http';
|
||||||
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
|
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
|
||||||
import Tooltip from '@/components/elements/tooltip/Tooltip';
|
import Tooltip from '@/components/elements/tooltip/Tooltip';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
import BlueprintNavigationItems from '@/blueprint/components/NavigationBar/Items';
|
|
||||||
|
import BeforeNavigation from '@/blueprint/components/Navigation/NavigationBar/BeforeNavigation';
|
||||||
|
import AdditionalItems from '@/blueprint/components/Navigation/NavigationBar/AdditionalItems';
|
||||||
|
import AfterNavigation from '@/blueprint/components/Navigation/NavigationBar/AfterNavigation';
|
||||||
|
|
||||||
const RightNavigation = styled.div`
|
const RightNavigation = styled.div`
|
||||||
& > a,
|
& > a,
|
||||||
|
@ -47,6 +50,7 @@ export default () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Before />
|
||||||
<div className={'w-full bg-neutral-900 shadow-md overflow-x-auto'}>
|
<div className={'w-full bg-neutral-900 shadow-md overflow-x-auto'}>
|
||||||
<SpinnerOverlay visible={isLoggingOut} />
|
<SpinnerOverlay visible={isLoggingOut} />
|
||||||
<div className={'mx-auto w-full flex items-center h-[3.5rem] max-w-[1200px]'}>
|
<div className={'mx-auto w-full flex items-center h-[3.5rem] max-w-[1200px]'}>
|
||||||
|
@ -74,7 +78,7 @@ export default () => {
|
||||||
</a>
|
</a>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
<BlueprintNavigationItems />
|
<AdditionalItems />
|
||||||
<Tooltip placement={'bottom'} content={'Account Settings'}>
|
<Tooltip placement={'bottom'} content={'Account Settings'}>
|
||||||
<NavLink to={'/account'}>
|
<NavLink to={'/account'}>
|
||||||
<span className={'flex items-center w-5 h-5'}>
|
<span className={'flex items-center w-5 h-5'}>
|
||||||
|
@ -90,5 +94,6 @@ export default () => {
|
||||||
</RightNavigation>
|
</RightNavigation>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<After />
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue