Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(home): improve mobile claims ux #1720

Merged
merged 4 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
use App\Community\Enums\ClaimSetType;
use App\Community\Enums\ClaimStatus;
use Illuminate\Support\Carbon;

$claimSetTypeCopy = ClaimSetType::toString(ClaimSetType::NewSet);
if ($claim['SetType'] !== ClaimSetType::NewSet) {
$claimSetTypeCopy = ClaimSetType::toString(ClaimSetType::Revision);
}

$targetTimestamp = $claim['Status'] === ClaimStatus::Active ? $claim['Created'] : $claim['DoneTime'];
$timeAgo = Carbon::createFromFormat("Y-m-d H:i:s", $targetTimestamp)->diffForHumans();

$gameSystemIconSrc = getSystemIconUrl($claim['ConsoleID']);
?>

<div class="rounded p-2 bg-embed w-full">
<div class="flex items-center gap-x-2.5">
{!! gameAvatar($claim, label: false, iconSize: 48, iconClass: 'border-0 rounded-sm badgeimg') !!}

<div class="flex flex-col gap-y-0.5 w-full">
<a class="leading-4 cursor-pointer">
{!! renderGameTitle($claim['GameTitle']) !!}
</a>

<div class="flex justify-between w-full text-xs tracking-tighter">
<div>
<img src="{{ $gameSystemIconSrc }}" width="18" height="18" alt="{{ $claim['ConsoleName'] }} console icon">
<span>{{ $claim['ConsoleName'] }}</span>
</div>
</div>

<div class="text-xs flex justify-between">
{!! userAvatar($claim['User'], iconSize: 14) !!}
<span class="text-xs tracking-tighter">{{ $claimSetTypeCopy }}, {{ $timeAgo }}</span>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

use App\Community\Enums\ClaimSetType;
use App\Community\Enums\ClaimStatus;
use Illuminate\Support\Carbon;

$claimSetTypeCopy = ClaimSetType::toString(ClaimSetType::NewSet);
if ($claim['SetType'] !== ClaimSetType::NewSet) {
$claimSetTypeCopy = ClaimSetType::toString(ClaimSetType::Revision);
}

$finishedTimeAgo = Carbon::createFromFormat("Y-m-d H:i:s", $claim['DoneTime'])->diffForHumans();
$targetTimestamp = $claim['Status'] === ClaimStatus::Active ? $claim['Created'] : $claim['DoneTime'];
$timeAgo = Carbon::createFromFormat("Y-m-d H:i:s", $targetTimestamp)->diffForHumans();
?>

<tr>
Expand All @@ -24,5 +25,10 @@

<td class="pr-0">{!! userAvatar($claim['User']) !!}</td>
<td>{{ $claimSetTypeCopy }}</td>
<td class="smalldate">{{ $finishedTimeAgo }}</td>
<td
class="smalldate cursor-help"
title="{{ getNiceDate(strtotime($targetTimestamp)) }}"
>
{{ $timeAgo }}
</td>
</tr>
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@
<p>Couldn't find any new sets/revisions.</p>
</div>
@else
<div class="overflow-x-auto sm:overflow-x-hidden">
<div class="flex flex-col gap-y-1 sm:hidden">
@foreach($claimData as $claim)
<x-claims.claim-mobile-block :claim="$claim" />
@endforeach
</div>

<div class="hidden sm:block overflow-x-hidden">
<table class="table-highlight mb-1">
<thead>
<tr class="do-not-highlight">
Expand All @@ -127,7 +133,7 @@

<tbody>
@foreach($claimData as $claim)
<x-claims.finished-claim-table-row :claim="$claim" />
<x-claims.claim-table-row :claim="$claim" />
@endforeach
</tbody>
</table>
Expand Down

This file was deleted.

11 changes: 9 additions & 2 deletions resources/views/community/components/claims/new-claims.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,26 @@
<p>Couldn't find any sets in progress.</p>
</div>
@else
<div class="overflow-x-auto sm:overflow-x-hidden">
<div class="flex flex-col gap-y-1 sm:hidden">
@foreach($claimData as $claim)
<x-claims.claim-mobile-block :claim="$claim" />
@endforeach
</div>

<div class="hidden sm:block">
<table class="table-highlight mb-1">
<thead>
<tr class="do-not-highlight">
<th>Game</th>
<th>Dev</th>
<th>Type</th>
<th class="whitespace-nowrap">Started</th>
</tr>
</thead>

<tbody>
@foreach($claimData as $claim)
<x-claims.new-claim-table-row :claim="$claim" />
<x-claims.claim-table-row :claim="$claim" />
@endforeach
</tbody>
</table>
Expand Down
Loading