Skip to content
Open
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
2 changes: 1 addition & 1 deletion app/Http/Controllers/CalendarFeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function show(CalendarFeedRequest $request)
{
$events = Event::query()
->with('organization', 'venue')
->future()
->ongoingAndFuture()
->oldest('active_at')
->when($request->validOrganizations()->isNotEmpty(), fn ($query) => $query->whereIn('organization_id', $request->validOrganizations()->pluck('id')))
->get()
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class EventsController extends Controller
{
public function index()
{
$months = Event::future()
$months = Event::ongoingAndFuture()
->published()
->with('organization', 'venue')
->orderBy('active_at')
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class HomeController extends Controller
public function index()
{
return view('index', [
'upcoming_events' => Event::future()
'upcoming_events' => Event::ongoingAndFuture()
->published()
->with('organization', 'venue')
->oldest('active_at')
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/OrgsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function show(Org $org)
'events' => function (Builder $query) {
$query
->with('organization', 'venue')
->future()
->ongoingAndFuture()
->published()
->orderBy('active_at')
->limit(25);
Expand Down
5 changes: 5 additions & 0 deletions app/Models/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public function scopeFuture(Builder $query): void
$query->where('active_at', '>=', now());
}

public function scopeOngoingAndFuture(Builder $query): void
{
$query->where('expire_at', '>=', now()->startOfDay());
}

public function url(): string
{
return $this->uri;
Expand Down
8 changes: 5 additions & 3 deletions resources/css/app.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "tailwindcss";
@import 'tailwindcss';

/* Migrate from tailwind.config.js theme.extend */
@theme {
Expand All @@ -7,15 +7,17 @@
--color-warning: #de9d35;
--color-danger: #f44336;

--font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
--font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans',
sans-serif;

--breakpoint-nav-break: 1220px;
}

/* Preserve v3 button cursor behavior */
@layer base {
button:not(:disabled),
[role="button"]:not(:disabled) {
[role='button']:not(:disabled) {
cursor: pointer;
}
}
Expand Down
10 changes: 7 additions & 3 deletions resources/js/labs-hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
*/
export function initHeroCanvas(canvas) {
const ctx = canvas.getContext('2d');
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const prefersReducedMotion = window.matchMedia(
'(prefers-reduced-motion: reduce)',
).matches;

const PARTICLE_COUNT = 60;
const CONNECT_DISTANCE = 120;
Expand Down Expand Up @@ -55,7 +57,7 @@ export function initHeroCanvas(canvas) {
const dy = p.y - mouse.y;
const dist = Math.sqrt(dx * dx + dy * dy);
if (dist < MOUSE_RADIUS && dist > 0) {
const force = (MOUSE_RADIUS - dist) / MOUSE_RADIUS * MOUSE_FORCE;
const force = ((MOUSE_RADIUS - dist) / MOUSE_RADIUS) * MOUSE_FORCE;
p.vx += (dx / dist) * force;
p.vy += (dy / dist) * force;
}
Expand Down Expand Up @@ -91,7 +93,9 @@ export function initHeroCanvas(canvas) {
ctx.beginPath();
ctx.moveTo(p.x, p.y);
ctx.lineTo(q.x, q.y);
ctx.strokeStyle = `rgba(255, 255, 255, ${0.15 * (1 - dist / CONNECT_DISTANCE)})`;
ctx.strokeStyle = `rgba(255, 255, 255, ${
0.15 * (1 - dist / CONNECT_DISTANCE)
})`;
ctx.lineWidth = 0.5;
ctx.stroke();
}
Expand Down
5 changes: 2 additions & 3 deletions tests/Feature/Http/Controllers/CalendarFeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,11 @@ public function test_older_events_never_show_up_on_calendar_feed(): void
$event = Event::factory()->create([
'organization_id' => $organization->id,
'cancelled_at' => null,
'active_at' => now()->subMinute(),
'expire_at' => now()->subMinute(),
'active_at' => now()->subWeek()->subMinute(),
'expire_at' => now()->subWeek(),
]);

$first_response = $this->get(route('calendar-feed.show', ['orgs' => $organization->id]));

preg_match('/UID:(.+)/', $first_response->getContent(), $first_match);

$this->assertFalse(isset($first_match[1]));
Expand Down
6 changes: 5 additions & 1 deletion tests/Feature/Http/Controllers/HomeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ public function test_upcoming_events_sorts_unordered_events()
Event::factory()->create([
'event_name' => 'Event 2',
'active_at' => '2020-01-01 19:00:00',
'expire_at' => '2020-01-02 21:00:00',
]);
Event::factory()->create([
'event_name' => 'Event 1',
'active_at' => '2020-01-01 18:00:00',
'expire_at' => '2020-01-02 20:00:00',
]);
Event::factory()->create([
'event_name' => 'Event 3',
'active_at' => '2020-01-02 12:00:00',
'expire_at' => '2020-01-02 14:00:00',
]);

$response = $this->get(route('home'));
Expand All @@ -40,7 +43,8 @@ public function test_upcoming_events_does_not_show_old_events()
{
Event::factory()->create([
'event_name' => 'Event 1',
'active_at' => '2019-12-31 23:59:59',
'active_at' => '2019-12-31 22:00:00',
'expire_at' => '2019-12-31 23:00:00',
]);

$response = $this->get(route('home'));
Expand Down
3 changes: 1 addition & 2 deletions tests/Feature/NoIndexNonProductionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class NoIndexNonProductionTest extends TestCase
{
public function test_robots_txt_disallows_all_in_non_production(): void
{
$this->assertEquals('testing', app()->environment());

$this->assertFalse(app()->isProduction());
$response = $this->get('/robots.txt');

$response->assertOk();
Expand Down
Loading