Skip to content

Commit

Permalink
fix(profiles): Serve static images from profiles page
Browse files Browse the repository at this point in the history
  • Loading branch information
lutangar committed Jul 10, 2020
1 parent 6a913dd commit 052eaed
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.development.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ SEND_IN_BLUE_TOKEN=token
CHROME_EXTENSION_ID=
FIREFOX_EXTENSION_ID=
PROFILES_ORIGIN=http://localhost:8080/
PROFILES_ASSETS_PATH=/
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ SEND_IN_BLUE_TOKEN=
CHROME_EXTENSION_ID=
FIREFOX_EXTENSION_ID=
PROFILES_ORIGIN=
PROFILES_ASSETS_PATH=
1 change: 1 addition & 0 deletions .env.proding
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ CHROME_EXTENSION_ID=mepoelfgpameiagpkgpjphnbgampgffm
FIREFOX_EXTENSION_ID={72aad822-62f5-4663-a8f0-025b2f9a3dd5}
BABEL_ENV=production
PROFILES_ORIGIN=http://localhost:8080
PROFILES_ASSETS_PATH=https://profiles.dismoi.io
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ [email protected]
CHROME_EXTENSION_ID=fpjlnlnbacohacebkadbbjebbipcknbg
FIREFOX_EXTENSION_ID=@lmem
PROFILES_ORIGIN=https://www.dismoi.io
PROFILES_ASSETS_PATH=https://profiles.dismoi.io
1 change: 1 addition & 0 deletions .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ [email protected]
CHROME_EXTENSION_ID=nfabbfkbbbcebdmnocndhdombaffkaog
FIREFOX_EXTENSION_ID={7d0d2553-c311-4acd-a170-f9a4714eb2c0}
BABEL_ENV=production
PROFILES_ASSETS_PATH=https://profiles.dismoi.io
5 changes: 3 additions & 2 deletions src/app/profiles/App/Profiles/Profile/ProfileBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { StatefulContributor } from 'app/lmem/contributor';
import styled from 'styled-components';
import { StatefulContributor } from 'app/lmem/contributor';
import defaultProfileBannerImage from 'assets/img/profile-banner.jpg';

const ProfileBannerContainer = styled.div<{
default: boolean;
Expand Down Expand Up @@ -43,7 +44,7 @@ const ProfileBanner = ({ contributor }: ProfileBannerProps) => {
src={
contributor && contributor.banner
? contributor.banner
: '/img/profile-banner.jpg'
: defaultProfileBannerImage
}
alt={getBannerAlt(contributor)}
/>
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '*.jpg';
15 changes: 15 additions & 0 deletions webpack.profiles.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ module.exports = function webpack(env = {}, argv = {}) {

return {
...defaultWebpackConfig,
module: {
rules: [
...defaultWebpackConfig.module.rules,
{
test: /\.(png|jpe?g|gif)$/i,
loader: 'file-loader',
options: {
publicPath: process.env.PROFILES_ASSETS_PATH,
name: '[path][name].[ext]',
context: 'src/assets',
},
},
]
},

entry: [
'core-js/stable',
'regenerator-runtime/runtime',
Expand Down

0 comments on commit 052eaed

Please sign in to comment.