Fix spinner shown in "See all my builds" when not logged in (#1542)

Fix #1541
This commit is contained in:
Pranav Shridhar
2020-03-17 19:24:53 +05:30
committed by GitHub
parent 9614549436
commit 2aba1c57c4
2 changed files with 16 additions and 6 deletions

View File

@@ -11,12 +11,14 @@ import { Column, Line } from '../../UI/Grid';
import EmptyMessage from '../../UI/EmptyMessage';
import PlaceholderLoader from '../../UI/PlaceholderLoader';
import BuildProgress from './BuildProgress';
import { type UserProfile } from '../../Profile/UserProfileContext';
import format from 'date-fns/format';
import difference_in_calendar_days from 'date-fns/difference_in_calendar_days';
import Text from '../../UI/Text';
type Props = {|
builds: ?Array<Build>,
userProfile: UserProfile,
onDownload: (build: Build, key: BuildArtifactKeyName) => void,
|};
@@ -41,7 +43,7 @@ const formatBuildText = (
}
};
export default ({ builds, onDownload }: Props) => {
export default ({ builds, userProfile, onDownload }: Props) => {
return (
<Column noMargin expand>
<Line>
@@ -49,19 +51,23 @@ export default ({ builds, onDownload }: Props) => {
<EmptyMessage>
<Trans>
This is the list of builds that you've done. Note that you can
download games generated during to 7 days, after which they are
removed.
download games generated during the last 7 days, after which they
are removed.
</Trans>
</EmptyMessage>
</Column>
</Line>
<Line>
{!builds ? (
{!userProfile.authenticated ? (
<EmptyMessage>
<Trans>You need to login first to see your builds.</Trans>
</EmptyMessage>
) : !builds ? (
<PlaceholderLoader />
) : builds.length === 0 ? (
<EmptyMessage>
<Trans>
You don't have any builds on the online services for now
You don't have any builds on the online services for now.
</Trans>
</EmptyMessage>
) : (

View File

@@ -82,7 +82,11 @@ export default class Builds extends Component<Props, State> {
render() {
return (
<BuildsList builds={this.state.builds} onDownload={this._download} />
<BuildsList
builds={this.state.builds}
userProfile={this.props.userProfile}
onDownload={this._download}
/>
);
}
}