File tree Expand file tree Collapse file tree 3 files changed +35
-3
lines changed
packages/app/src/app/pages/Profile Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change 1+ import * as React from 'react' ;
12import styled from 'styled-components' ;
23
4+ import Centered from 'common/components/flex/Centered' ;
5+ import Margin from 'common/components/spacing/Margin' ;
6+
37export const Navigation = styled . div `
48 width: 100%;
59 display: flex;
@@ -15,3 +19,21 @@ export const Notice = styled.div`
1519 padding: 2rem 0;
1620 padding-bottom: 0;
1721` ;
22+
23+ const ErrorTitle = styled . div `
24+ font-size: 1.25rem;
25+ color: rgba(255, 255, 255, 0.7);
26+ ` ;
27+ const prefix = {
28+ currentSandboxes : [ "You don't have" , "This user doesn't have" ] ,
29+ currentLikedSandboxes : [ "You didn't like" , "This user didn't like" ] ,
30+ } ;
31+ export const NoSandboxes = ( { source, isCurrentUser } ) => (
32+ < Centered vertical horizontal >
33+ < Margin top = { 4 } >
34+ < ErrorTitle >
35+ { prefix [ source ] [ isCurrentUser ? 0 : 1 ] } any sandboxes yet
36+ </ ErrorTitle >
37+ </ Margin >
38+ </ Centered >
39+ ) ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { inject, observer } from 'mobx-react';
44import Button from 'app/components/Button' ;
55import SandboxList from 'app/components/SandboxList' ;
66
7- import { Navigation , Notice } from './elements' ;
7+ import { Navigation , Notice , NoSandboxes } from './elements' ;
88
99const PER_PAGE_COUNT = 15 ;
1010
@@ -71,6 +71,13 @@ class Sandboxes extends React.Component {
7171 if ( isLoadingSandboxes || ! sandboxes || ! sandboxes . get ( page ) )
7272 return < div /> ;
7373
74+ const sandboxesPage = sandboxes . get ( page ) ;
75+
76+ if ( sandboxesPage . length === 0 )
77+ return (
78+ < NoSandboxes source = { source } isCurrentUser = { isProfileCurrentUser } />
79+ ) ;
80+
7481 return (
7582 < div >
7683 { isProfileCurrentUser && (
@@ -81,7 +88,7 @@ class Sandboxes extends React.Component {
8188 ) }
8289 < SandboxList
8390 isCurrentUser = { isProfileCurrentUser }
84- sandboxes = { sandboxes . get ( page ) }
91+ sandboxes = { sandboxesPage }
8592 onDelete = { source === 'currentSandboxes' && this . deleteSandbox }
8693 />
8794 < Navigation >
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ class Showcase extends React.Component {
3535 return (
3636 < Centered vertical horizontal >
3737 < Margin top = { 4 } >
38- < ErrorTitle > This user doesn{ "'" } t have a sandbox yet</ ErrorTitle >
38+ < ErrorTitle >
39+ { isCurrentUser ? "You don't" : "This user doesn't" } have any
40+ sandboxes yet
41+ </ ErrorTitle >
3942 </ Margin >
4043 </ Centered >
4144 ) ;
You can’t perform that action at this time.
0 commit comments