Skip to content

Commit

Permalink
M3 clapps icons (#4644)
Browse files Browse the repository at this point in the history
* Add hard-coded icons

* Adapt for Linode account request

* Format Clapps names for display

* Clean up 2

* Review feedback

- Add APP_ROOT constant to icon URL

* Remove duplicate URL slash
  • Loading branch information
Jskobos authored and martinmckenna committed Mar 25, 2019
1 parent e5c80fa commit 7cca6e1
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion public/assets/Ark@1x.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/assets/CSGO2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/assets/Rust.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/assets/Terraria.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class LinodeCreateContainer extends React.PureComponent<CombinedProps, State> {
.then(response => {
this.setState({
appInstancesLoading: false,
appInstances: response.data
appInstances: response
});
})
.catch(e => {
Expand Down
9 changes: 6 additions & 3 deletions src/features/linodes/LinodesCreate/SelectAppPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import ErrorState from 'src/components/ErrorState';
import Grid from 'src/components/Grid';
import LinearProgress from 'src/components/LinearProgress';
import SelectionCard from 'src/components/SelectionCard';
import { APP_ROOT } from 'src/constants';
import Panel from './Panel';

import { iconMap } from './TabbedContent/formUtilities';
import { AppsData } from './types';

type ClassNames = 'flatImagePanelSelections' | 'panel' | 'loading';
Expand Down Expand Up @@ -98,6 +99,7 @@ const SelectAppPanel: React.SFC<CombinedProps> = props => {
handleClick={handleClick}
disabled={disabled}
id={eachApp.id}
iconUrl={iconMap[eachApp.id]}
/>
))}
</Grid>
Expand All @@ -120,6 +122,7 @@ interface SelectionProps {
stackScriptImages: string[],
userDefinedFields: Linode.StackScript.UserDefinedField[]
) => void;
iconUrl: string;
id: number;
label: string;
username: string;
Expand Down Expand Up @@ -149,14 +152,14 @@ class SelectionCardWrapper extends React.PureComponent<SelectionProps> {
};

render() {
const { id, checked, label, disabled } = this.props;
const { iconUrl, id, checked, label, disabled } = this.props;
return (
<SelectionCard
key={id}
checked={checked}
onClick={this.handleSelectApp}
renderIcon={() => {
return <span className={`fl-coreos`} />;
return <img src={`${APP_ROOT}${iconUrl}`} />;
}}
heading={label}
subheadings={['']}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,32 @@ export const filterUDFErrors = (
export const getCloudApps = (params?: any, filter?: any) =>
getStackscripts(params, {
...filter,
username: 'capuk'
username: 'linode'
}).then(response => {
return response.data
.filter(script => {
return Object.keys(iconMap).includes(String(script.id));
})
.map(script => ({
// so sorry about this
...script,
label: script.label.replace('One-Click', '').replace('- OneClick', '')
}));
});

export const iconMap = {
401705: '/assets/Terraria.svg',
401699: '/assets/Ark@1x.svg',
401704: '/assets/TF2.svg',
401703: '/assets/Rust.svg',
401707: '/assets/GitLab.svg',
401709: '/assets/Minecraft.svg',
401698: '/assets/Drupal.svg',
401706: '/assets/Wireguard.svg',
401708: '/assets/WooCommerce.svg',
401697: '/assets/WordPress.svg',
401700: '/assets/CSGO2.svg',
401701: '/assets/LAMP.svg',
401702: '/assets/MERN.svg',
401719: '/assets/OpenVPN.svg'
};

0 comments on commit 7cca6e1

Please sign in to comment.