Skip to content

Commit

Permalink
Merge pull request #2714 from processing/feature/fundraiser-content
Browse files Browse the repository at this point in the history
Add Promotion for 2023 Fundraiser
  • Loading branch information
raclim authored Dec 15, 2023
2 parents d2267f4 + 96dd429 commit 251f6ed
Show file tree
Hide file tree
Showing 16 changed files with 1,241 additions and 2 deletions.
2 changes: 2 additions & 0 deletions client/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export const SHOW_EDITOR_OPTIONS = 'SHOW_EDITOR_OPTIONS';
export const CLOSE_EDITOR_OPTIONS = 'CLOSE_EDITOR_OPTIONS';
export const SHOW_KEYBOARD_SHORTCUT_MODAL = 'SHOW_KEYBOARD_SHORTCUT_MODAL';
export const CLOSE_KEYBOARD_SHORTCUT_MODAL = 'CLOSE_KEYBOARD_SHORTCUT_MODAL';
export const SHOW_FUNDRAISER_MODAL = 'SHOW_FUNDRAISER_MODAL';
export const CLOSE_FUNDRAISER_MODAL = 'CLOSE_FUNDRAISER_MODAL';
export const SHOW_TOAST = 'SHOW_TOAST';
export const HIDE_TOAST = 'HIDE_TOAST';
export const SET_TOAST_TEXT = 'SET_TOAST_TEXT';
Expand Down
1,025 changes: 1,025 additions & 0 deletions client/images/processing-foundation-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions client/modules/IDE/actions/ide.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ export function closeKeyboardShortcutModal() {
};
}

export function showFundraiserModal() {
return {
type: ActionTypes.SHOW_FUNDRAISER_MODAL
};
}

export function closeFundraiserModal() {
return {
type: ActionTypes.CLOSE_FUNDRAISER_MODAL
};
}

export function setUnsavedChanges(value) {
return {
type: ActionTypes.SET_UNSAVED_CHANGES,
Expand Down
14 changes: 14 additions & 0 deletions client/modules/IDE/components/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,20 @@ function About(props) {
Discord
</a>
</p>
<p className="about__content-column-list">
<a
href="https://p5js.org/download/support.html"
target="_blank"
rel="noopener noreferrer"
>
<AsteriskIcon
className="about__content-column-asterisk"
aria-hidden="true"
focusable="false"
/>
Donate
</a>
</p>
<p className="about__content-column-list">
<Link to="/privacy-policy">
<AsteriskIcon
Expand Down
36 changes: 36 additions & 0 deletions client/modules/IDE/components/FundraiserModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import LogoIcon from '../../../images/p5js-logo.svg';
import PFLogoIcon from '../../../images/processing-foundation-logo.svg';

export default function FundraiserModal() {
const { t } = useTranslation();

return (
<div className="fundraiser">
<p className="fundraiser__description">{t('Fundraiser.Description')}</p>
<div className="fundraiser__img-container">
<LogoIcon
className="fundraiser__logo-p5"
role="img"
aria-label={t('Common.p5logoARIA')}
focusable="false"
/>
<PFLogoIcon
className="fundraiser__logo-PF"
role="img"
aria-label={t('Common.PFlogoARIA')}
focusable="false"
/>
</div>
<a
className="fundraiser__CTA"
href="https://donorbox.org/to-the-power-of-10"
target="_blank"
rel="noopener noreferrer"
>
{t('Fundraiser.CallToAction')}
</a>
</div>
);
}
6 changes: 5 additions & 1 deletion client/modules/IDE/components/Header/MobileNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {
newFile,
newFolder,
openPreferences,
showKeyboardShortcutModal
showKeyboardShortcutModal,
showFundraiserModal
} from '../../actions/ide';
import { logoutUser } from '../../../User/actions';
import { useSketchActions, useWhatPage } from '../../hooks';
Expand Down Expand Up @@ -434,6 +435,9 @@ const MoreMenu = () => {
{t('Nav.Help.Reference')}
</NavMenuItem>
<NavMenuItem href="/about">{t('Nav.Help.About')}</NavMenuItem>
<NavMenuItem onClick={() => dispatch(showFundraiserModal())}>
{t('Nav.Fundraiser')}
</NavMenuItem>
</ParentMenuContext.Provider>
</ul>
</div>
Expand Down
20 changes: 20 additions & 0 deletions client/modules/IDE/components/Header/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
newFile,
newFolder,
showKeyboardShortcutModal,
showFundraiserModal,
startSketch,
stopSketch
} from '../../actions/ide';
Expand All @@ -37,6 +38,7 @@ const Nav = ({ layout }) => (
matches ? (
<NavBar>
<LeftLayout layout={layout} />
<FundraiserSection />
<UserMenu />
</NavBar>
) : (
Expand Down Expand Up @@ -85,6 +87,24 @@ const UserMenu = () => {
return null;
};

const FundraiserSection = () => {
const { t } = useTranslation();
const dispatch = useDispatch();

return (
<>
<button
className="nav__fundraiser-btn"
onClick={() => dispatch(showFundraiserModal())}
aria-label="2023-fundraiser-button"
title="2023 Fundraiser Button"
>
{t('Nav.Fundraiser')}
</button>
</>
);
};

const DashboardMenu = () => {
const { t } = useTranslation();
const editorLink = useSelector(selectSketchPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ exports[`Nav renders dashboard version for desktop 1`] = `
</a>
</li>
</ul>
<button
aria-label="2023-fundraiser-button"
class="nav__fundraiser-btn"
title="2023 Fundraiser Button"
>
Support p5.js and the Processing Foundation!
</button>
</nav>
</header>
</DocumentFragment>
Expand Down Expand Up @@ -450,6 +457,13 @@ exports[`Nav renders dashboard version for mobile 1`] = `
About
</a>
</li>
<li
class="nav__dropdown-item"
>
<button>
Support p5.js and the Processing Foundation!
</button>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -666,6 +680,13 @@ exports[`Nav renders editor version for desktop 1`] = `
</ul>
</li>
</ul>
<button
aria-label="2023-fundraiser-button"
class="nav__fundraiser-btn"
title="2023 Fundraiser Button"
>
Support p5.js and the Processing Foundation!
</button>
</nav>
</header>
</DocumentFragment>
Expand Down Expand Up @@ -1077,6 +1098,13 @@ exports[`Nav renders editor version for mobile 1`] = `
About
</a>
</li>
<li
class="nav__dropdown-item"
>
<button>
Support p5.js and the Processing Foundation!
</button>
</li>
</ul>
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions client/modules/IDE/components/IDEOverlays.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useLocation, useParams } from 'react-router-dom';
import Overlay from '../../App/components/Overlay';
import {
closeKeyboardShortcutModal,
closeFundraiserModal,
closePreferences,
closeShareModal,
hideErrorModal
Expand All @@ -14,6 +15,7 @@ import AddToCollectionList from './AddToCollectionList';
import ErrorModal from './ErrorModal';
import Feedback from './Feedback';
import KeyboardShortcutModal from './KeyboardShortcutModal';
import FundraiserModal from './FundraiserModal';
import NewFileModal from './NewFileModal';
import NewFolderModal from './NewFolderModal';
import Preferences from './Preferences';
Expand All @@ -33,6 +35,7 @@ export default function IDEOverlays() {
uploadFileModalVisible,
preferencesIsVisible,
keyboardShortcutVisible,
fundraiserContentVisible,
shareModalVisible,
shareModalProjectId,
shareModalProjectName,
Expand Down Expand Up @@ -106,6 +109,15 @@ export default function IDEOverlays() {
<KeyboardShortcutModal />
</Overlay>
)}
{fundraiserContentVisible && (
<Overlay
title={t('Fundraiser.Title')}
ariaLabel={t('Fundraiser.Title')}
closeOverlay={() => dispatch(closeFundraiserModal())}
>
<FundraiserModal />
</Overlay>
)}
{errorType && (
<Overlay
title={t('Common.Error')}
Expand Down
5 changes: 5 additions & 0 deletions client/modules/IDE/reducers/ide.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const initialState = {
shareModalProjectName: 'My Cute Sketch',
shareModalProjectUsername: 'p5_user',
keyboardShortcutVisible: false,
fundraiserContentVisible: false,
unsavedChanges: false,
infiniteLoop: false,
previewIsRefreshing: false,
Expand Down Expand Up @@ -85,6 +86,10 @@ const ide = (state = initialState, action) => {
return Object.assign({}, state, { keyboardShortcutVisible: true });
case ActionTypes.CLOSE_KEYBOARD_SHORTCUT_MODAL:
return Object.assign({}, state, { keyboardShortcutVisible: false });
case ActionTypes.SHOW_FUNDRAISER_MODAL:
return Object.assign({}, state, { fundraiserContentVisible: true });
case ActionTypes.CLOSE_FUNDRAISER_MODAL:
return Object.assign({}, state, { fundraiserContentVisible: false });
case ActionTypes.SET_UNSAVED_CHANGES:
return Object.assign({}, state, { unsavedChanges: action.value });
case ActionTypes.DETECT_INFINITE_LOOPS:
Expand Down
10 changes: 10 additions & 0 deletions client/styles/abstracts/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ $themes: (
button-nav-inactive-color: $middle-gray,
button-hover-color: $lightest,
button-active-color: $lightest,
fundraiser-button-nav-color: $p5js-pink,
fundraiser-button-background-color: $p5js-pink,
fundraiser-button-color: $white,
fundraiser-button-hover-active-color: $medium-dark,
modal-background-color: $light,
preferences-button-background-color: $medium-light,
modal-border-color: $middle-light,
Expand Down Expand Up @@ -164,6 +168,9 @@ $themes: (
editor-gutter-color: $darker,
file-hover-color: $dark,
file-selected-color: $medium-dark,
fundraiser-button-background-color: $p5js-pink,
fundraiser-button-color: $white,
fundraiser-button-hover-active-color: $medium-dark,
input-text-color: $lightest,
input-background-color: $dark,
input-secondary-background-color: $medium-dark,
Expand Down Expand Up @@ -258,6 +265,9 @@ $themes: (
editor-gutter-color: $darker,
file-hover-color: $dark,
file-selected-color: $medium-dark,
fundraiser-button-background-color: $yellow,
fundraiser-button-color: $dark,
fundraiser-button-hover-active-color: $medium-light,
input-text-color: $lightest,
input-background-color: $dark,
input-secondary-background-color: $medium-dark,
Expand Down
53 changes: 53 additions & 0 deletions client/styles/components/_fundraiser.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.fundraiser {
padding: #{20 / $base-font-size}rem;
margin-right: #{20 / $base-font-size}rem;
padding-bottom: #{40 / $base-font-size}rem;
width: #{500 / $base-font-size}rem;
text-align: center;
overflow-y: auto;
}

.fundraiser__CTA {
font-size: #{23 / $base-font-size}rem;
font-weight: bold;
margin-top: #{10 / $base-font-size}rem;
padding: #{20 / $base-font-size}rem;
border-radius: #{35 / $base-font-size}rem;

@include themify() {
color: getThemifyVariable('fundraiser-button-color');
background-color: getThemifyVariable('fundraiser-button-background-color');
}

&:hover,
&:focus {
@include themify() {
color: getThemifyVariable('fundraiser-button-color');
background-color: getThemifyVariable('fundraiser-button-hover-active-color');
}
}
}

.fundraiser__description {
margin: #{20 / $base-font-size}rem 0;
font-size: #{20 / $base-font-size}rem;
}

.fundraiser__img-container {
display: flex;
justify-content: center;
margin: #{40 / $base-font-size}rem 0 #{55 / $base-font-size}rem 0;
}

.fundraiser__logo-p5 {
margin: 0 #{15 / $base-font-size}rem 0 #{30 / $base-font-size}rem;
width:#{150 / $base-font-size}rem;
height:#{150 / $base-font-size}rem;
}

.fundraiser__logo-PF {
margin-left: #{20 / $base-font-size}rem;
padding-bottom: #{15 / $base-font-size}rem;
width:#{250 / $base-font-size}rem;
height:#{150 / $base-font-size}rem;
}
9 changes: 9 additions & 0 deletions client/styles/components/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
align-items: center;
}

.nav__fundraiser-btn {
font-weight: bold;
font-size: #{14 / $base-font-size}rem;
@include themify() {
color: getThemifyVariable('fundraiser-button-nav-color');
}
}


.preview-nav__editor-svg {
@include icon();
}
Expand Down
1 change: 1 addition & 0 deletions client/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
@import 'components/asset-list';
@import 'components/asset-size';
@import 'components/keyboard-shortcuts';
@import 'components/fundraiser';
@import 'components/copyable-input';
@import 'components/feedback';
@import 'components/console-input';
Expand Down
1 change: 1 addition & 0 deletions client/testData/testReduxStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const initialTestState = {
shareModalProjectName: 'My Cute Sketch',
shareModalProjectUsername: 'p5_user',
keyboardShortcutVisible: false,
fundraiserContentVisible: false,
unsavedChanges: false,
infiniteLoop: false,
previewIsRefreshing: false,
Expand Down
Loading

0 comments on commit 251f6ed

Please sign in to comment.