Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release' into lagoon-slb-146
Browse files Browse the repository at this point in the history
  • Loading branch information
dspachos committed Apr 11, 2024
2 parents 130535a + 92221da commit e8314ea
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 12 deletions.
18 changes: 10 additions & 8 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
FROM gitpod/workspace-full

RUN bash -c 'VERSION="18.19.0" \
&& source $HOME/.nvm/nvm.sh && nvm install $VERSION \
&& nvm use $VERSION && nvm alias default $VERSION'

RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix

RUN sudo update-alternatives --set php $(which php8.2)
RUN sudo install-packages php8.2-gd php8.2-mbstring php8.2-curl php8.2-sqlite3 php8.2-zip php8.2-xdebug php8.2-imagick
RUN pnpx [email protected] install-deps
Expand All @@ -11,14 +18,9 @@ RUN /home/gitpod/.deno/bin/deno completions bash > /home/gitpod/.bashrc.d/90-den
echo 'export DENO_INSTALL="/home/gitpod/.deno"' >> /home/gitpod/.bashrc.d/90-deno && \
echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> /home/gitpod/.bashrc.d/90-deno

# Install neovim and helpers
RUN wget https://github.com/neovim/neovim/releases/download/v0.9.2/nvim-linux64.tar.gz && \
tar xzf nvim-linux64.tar.gz && \
sudo mv nvim-linux64 /usr/local/nvim && \
sudo ln -s /usr/local/nvim/bin/nvim /usr/local/bin/nvim && \
rm -rf nvim-linux64.tar.gz
RUN sudo apt-get install -y fd-find
RUN npm install -g neovim
RUN sudo add-apt-repository ppa:maveonair/helix-editor && \
sudo apt update && \
sudo apt install helix

# Install phpactor
RUN curl -Lo phpactor.phar https://github.com/phpactor/phpactor/releases/latest/download/phpactor.phar
Expand Down
42 changes: 41 additions & 1 deletion packages/drupal/gutenberg_blocks/src/blocks/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@ import {
RichText,
} from 'wordpress__block-editor';
import { registerBlockType } from 'wordpress__blocks';
import { PanelBody } from 'wordpress__components';
import { PanelBody, SelectControl } from 'wordpress__components';
import { compose, withState } from 'wordpress__compose';
import { dispatch } from 'wordpress__data';

import { DrupalMediaEntity } from '../utils/drupal-media';

declare const drupalSettings: {
customGutenbergBlocks: {
forms: Array<{
id: string;
url: string;
label: string;
}>;
};
};

// @ts-ignore
const { t: __ } = Drupal;
// @ts-ignore
Expand Down Expand Up @@ -44,6 +54,9 @@ registerBlockType('custom/hero', {
type: 'boolean',
default: true,
},
formId: {
type: 'string',
},
},
supports: {
inserter: false,
Expand Down Expand Up @@ -93,6 +106,23 @@ registerBlockType('custom/hero', {
</button>
)}
</PanelBody>
<PanelBody title={__('Form')}>
<SelectControl
value={props.attributes.formId as string}
options={[
{ label: __('- Select a form -'), value: '' },
...drupalSettings.customGutenbergBlocks.forms.map((form) => ({
label: form.label,
value: form.id,
})),
]}
onChange={(formId: string) => {
props.setAttributes({
formId,
});
}}
/>
</PanelBody>
</InspectorControls>
<div>
<div>
Expand Down Expand Up @@ -169,6 +199,16 @@ registerBlockType('custom/hero', {
/>
</div>
)}
{props.attributes.formId ? (
<iframe
src={
drupalSettings.customGutenbergBlocks.forms.find(
(form) => form.id === props.attributes.formId,
)!.url + '?iframe=true'
}
style={{ width: '100%', height: 300, pointerEvents: 'none' }}
/>
) : null}
</div>
</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ default:
body:
-
value: |-
<!-- wp:custom/hero {"mediaEntityIds":["3a0fe860-a6d6-428a-9474-365bd57509aa"],"headline":"All kinds of blocks with maximum data","lead":"Lead text","ctaUrl":"https://example.com","ctaText":"CTA text"} /-->
<!-- wp:custom/hero {"mediaEntityIds":["3a0fe860-a6d6-428a-9474-365bd57509aa"],"headline":"All kinds of blocks with maximum data","lead":"Lead text","ctaUrl":"https://example.com","ctaText":"CTA text","formId":"contact"} /-->
<!-- wp:custom/content -->
<!-- wp:paragraph -->
Expand Down
1 change: 1 addition & 0 deletions packages/schema/src/fragments/Page.gql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fragment Page on Page {
}
ctaText
ctaUrl
formUrl
}
content {
__typename
Expand Down
3 changes: 3 additions & 0 deletions packages/schema/src/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ type Hero {
image: MediaImage @resolveEditorBlockMedia
ctaText: String @resolveEditorBlockAttribute(key: "ctaText")
ctaUrl: Url @resolveEditorBlockAttribute(key: "ctaUrl")
formUrl: Url
@resolveEditorBlockAttribute(key: "formId")
@webformIdToUrl(id: "$")
}

union PageContent @resolveEditorBlockType = BlockMarkup | BlockMedia | BlockForm
Expand Down
7 changes: 5 additions & 2 deletions packages/ui/src/components/Organisms/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,18 @@ export function Footer() {
}
>
<div className={'text-base'}>
<p className="mt-10 text-center text-xs leading-5 text-gray-500">
<p
className="mt-10 text-center text-xs leading-5 text-gray-500"
data-chromatic="ignore"
>
&copy;{' '}
{intl.formatMessage(
{
defaultMessage: '{year} {company_name}. All rights reserved.',
id: 'qA8qQH',
},
{
year: 2024,
year: new Date().getFullYear(),
company_name: intl.formatMessage({
defaultMessage: 'Company name',
id: 'FPGwAt',
Expand Down
3 changes: 3 additions & 0 deletions tests/schema/specs/blocks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ test('Blocks', async () => {
}
ctaText
ctaUrl
formUrl
}
content {
__typename
Expand Down Expand Up @@ -104,6 +105,7 @@ test('Blocks', async () => {
"__typename": "Hero",
"ctaText": "CTA text",
"ctaUrl": "https://example.com",
"formUrl": "http://127.0.0.1:8000/en/form/contact",
"headline": "All kinds of blocks with maximum data",
"image": {
"__typename": "MediaImage",
Expand Down Expand Up @@ -139,6 +141,7 @@ test('Blocks', async () => {
"__typename": "Hero",
"ctaText": null,
"ctaUrl": null,
"formUrl": null,
"headline": "All kinds of blocks with minimum data",
"image": null,
"lead": null,
Expand Down

0 comments on commit e8314ea

Please sign in to comment.