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

PRESS2-302 | Build Colors Design Step #88

Merged
merged 51 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
365b3b0
Added Hardcoded Color Palettes
officiallygod Sep 28, 2022
03a6727
Created a basic Layout of Colors
officiallygod Sep 28, 2022
c90546c
Added a Live Preview for the Colors Step
officiallygod Sep 29, 2022
317f66f
Added Drawer to DB Save
officiallygod Sep 29, 2022
38ebb6b
Added Color change on Click
officiallygod Sep 29, 2022
95dfaa7
Changed Selected Color to Blue
officiallygod Sep 29, 2022
47617eb
Implemented new DB design
officiallygod Sep 29, 2022
30e4410
Update DesignColors.js
officiallygod Sep 29, 2022
8a7477d
Added Custom Palette
officiallygod Sep 29, 2022
2de0805
Added Color Picker
officiallygod Sep 29, 2022
32c9527
Close Popover on Select
officiallygod Sep 29, 2022
56b1ea2
Fixed CSS
officiallygod Sep 29, 2022
62d0bd8
Added Support for Custom Colors
officiallygod Sep 30, 2022
e545cce
Added a Close Dialog Button
officiallygod Sep 30, 2022
a851244
Removed Custom Colors on Style Selection
officiallygod Sep 30, 2022
b56bb26
Added Accordion and Animation
officiallygod Sep 30, 2022
1191f3d
Update index.js
officiallygod Sep 30, 2022
94bf19e
Added patternID to step in Data
officiallygod Oct 3, 2022
b1629dd
Refactored the code
officiallygod Oct 3, 2022
c7e0799
Added Default Colors
officiallygod Oct 3, 2022
f02c449
Update DesignColors.js
officiallygod Oct 3, 2022
7a34a7a
Fixed on Refresh setting of colors
officiallygod Oct 4, 2022
da894f4
Added Primary Color in custom colors
officiallygod Oct 4, 2022
b15e754
Fixed Injection of steps
officiallygod Oct 6, 2022
e11af01
Refactored CSS class names
officiallygod Oct 6, 2022
b43c907
Removed unused css class
officiallygod Oct 6, 2022
0ad95cf
Removed Log Statement
officiallygod Oct 6, 2022
aa358c2
Changed order of function call.
officiallygod Oct 6, 2022
7b58f57
Update DesignColors.js
officiallygod Oct 6, 2022
c5c77ff
Merge remote-tracking branch 'origin/release/v1.0.0' into PRESS2-302-…
officiallygod Oct 7, 2022
8f4d5fe
Merge branch 'release/v1.0.0' into PRESS2-302-Build-Colors-Design-Step
officiallygod Oct 7, 2022
2565f0b
Fixed Min Height before render
officiallygod Oct 7, 2022
53dff7b
Fixed Review comments
officiallygod Oct 11, 2022
cdc92e6
Added default Data Structure in Flows
officiallygod Oct 11, 2022
a96ac64
Refactored Code
officiallygod Oct 11, 2022
a502c7e
Removed unused vars and rearranged function declarations
officiallygod Oct 11, 2022
1d36408
Refactored Code
officiallygod Oct 11, 2022
3bea564
Added a API to fetch Theme Colors
officiallygod Oct 12, 2022
d734a9e
Tweaks
officiallygod Oct 12, 2022
52d061c
Update index.js
officiallygod Oct 12, 2022
ce51acc
Delete build/0.2.3 directory
officiallygod Oct 12, 2022
a1cb78d
Review Comments
officiallygod Oct 17, 2022
043a3d5
Added CSS Classes
officiallygod Oct 17, 2022
fe03b9b
Update DesignColors.js
officiallygod Oct 18, 2022
d84c42a
Added Hover Highlight
officiallygod Oct 18, 2022
f6df56b
Fixed a Glitch
officiallygod Oct 20, 2022
421227a
Revert "Fixed a Glitch"
officiallygod Oct 20, 2022
fae9dd2
Revert "Revert "Fixed a Glitch""
officiallygod Oct 20, 2022
e0de750
Fixed Rendering Issue
officiallygod Oct 20, 2022
dc931cf
Added Reset Button
officiallygod Oct 21, 2022
b204b8c
Formatting with phpcbf
officiallygod Oct 21, 2022
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
95 changes: 92 additions & 3 deletions src/OnboardingSPA/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { setFlow } from '../../utils/api/flow';
import { getSettings, setSettings } from '../../utils/api/settings';
import { isEmpty, updateWPSettings } from '../../utils/api/ecommerce';
import { store as nfdOnboardingStore } from '../../store';
import { conditionalSteps } from '../../data/routes/';

import { kebabCase } from 'lodash';
import { kebabCase, orderBy, filter } from 'lodash';
import { useViewportMatch } from '@wordpress/compose';
import { useDispatch, useSelect } from '@wordpress/data';
import { SlotFillProvider } from '@wordpress/components';
Expand All @@ -33,21 +34,33 @@ const App = () => {
newfoldBrand,
onboardingFlow,
currentData,
firstStep
firstStep,
routes,
designSteps,
allSteps,
} = useSelect((select) => {
return {
isDrawerOpen: select(nfdOnboardingStore).isDrawerOpened(),
newfoldBrand: select(nfdOnboardingStore).getNewfoldBrand(),
onboardingFlow: select(nfdOnboardingStore).getOnboardingFlow(),
currentData: select(nfdOnboardingStore).getCurrentOnboardingData(),
firstStep: select(nfdOnboardingStore).getFirstStep(),
routes: select(nfdOnboardingStore).getRoutes(),
allSteps: select(nfdOnboardingStore).getAllSteps(),
designSteps: select(nfdOnboardingStore).getDesignSteps(),
};
}, []);

const [isRequestPlaced, setIsRequestPlaced] = useState(false);
const [didVisitBasicInfo, setDidVisitBasicInfo] = useState(false);
const [didVisitEcommerce, setDidVisitEcommerce] = useState(false);
const { setActiveStep, setActiveFlow, setCurrentOnboardingData } = useDispatch(nfdOnboardingStore);
const { setActiveStep,
setActiveFlow,
updateRoutes,
updateDesignSteps,
updateAllSteps,
setCurrentOnboardingData,
} = useDispatch(nfdOnboardingStore);

async function syncSocialSettings() {
const initialData = await getSettings();
Expand Down Expand Up @@ -130,12 +143,88 @@ const App = () => {
}
}

const addColorAndTypographyRoutes = () => {
const updates = removeColorAndTypographyRoutes();
const steps = [
conditionalSteps.designColors,
conditionalSteps.designTypography,
];
return {
routes: orderBy(
updates.routes.concat(steps),
['priority'],
['asc']
),
allSteps: orderBy(
updates.allSteps.concat(steps),
['priority'],
['asc']
),
designSteps: orderBy(
updates.designSteps.concat(steps),
['priority'],
['asc']
),
};
};

const removeColorAndTypographyRoutes = () => {
return {
routes: filter(
routes,
(route) =>
!route.path.includes(
conditionalSteps.designColors.path
) &&
!route.path.includes(
conditionalSteps.designTypography.path
)
),
allSteps: filter(
allSteps,
(allStep) =>
!allStep.path.includes(
conditionalSteps.designColors.path
) &&
!allStep.path.includes(
conditionalSteps.designTypography.path
)
),
designSteps: filter(
designSteps,
(designStep) =>
!designStep.path.includes(
conditionalSteps.designColors.path
) &&
!designStep.path.includes(
conditionalSteps.designTypography.path
)
),
};
};

function handleInjectedSteps() {
officiallygod marked this conversation as resolved.
Show resolved Hide resolved
if (location?.pathname.includes('colors') || location?.pathname.includes('typography')){
let updates;

if (currentData?.data?.customDesign)
updates = addColorAndTypographyRoutes();
else
updates = removeColorAndTypographyRoutes();
officiallygod marked this conversation as resolved.
Show resolved Hide resolved

updateRoutes(updates.routes);
updateDesignSteps(updates.designSteps);
updateAllSteps(updates.allSteps);
}
}

useEffect(() => {
document.body.classList.add(`nfd-brand-${newfoldBrand}`);
}, [newfoldBrand]);

useEffect( () => {
syncStoreToDB();
handleInjectedSteps();
if ( location.pathname.includes( '/step' ) ) {
setActiveFlow( onboardingFlow );
setActiveStep( location.pathname );
Expand Down
Loading