Skip to content

Commit

Permalink
💄✨ Add experimental ui of a JS only checkin-flow (#1922)
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrLevin authored Sep 22, 2023
1 parent 6f2a62c commit 1bd9881
Show file tree
Hide file tree
Showing 20 changed files with 1,039 additions and 166 deletions.
38 changes: 37 additions & 1 deletion .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions .idea/trwl.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions app/Http/Controllers/Frontend/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ public function renderMutedUsers(): Renderable {

public function updateMainSettings(Request $request): RedirectResponse {
$validated = $request->validate([
'username' => [
'username' => [
'required', 'string', 'max:25', 'regex:/^[a-zA-Z0-9_]*$/'
],
'name' => ['required', 'string', 'max:50'],
'email' => ['required', 'string', 'email:rfc,dns', 'max:255'],
'mapprovider' => ['required', new Enum(MapProvider::class)],
'timezone' => ['required', Rule::in(DateTimeZone::listIdentifiers())]
'name' => ['required', 'string', 'max:50'],
'email' => ['required', 'string', 'email:rfc,dns', 'max:255'],
'mapprovider' => ['required', new Enum(MapProvider::class)],
'timezone' => ['required', Rule::in(DateTimeZone::listIdentifiers())],
'experimental' => ['required', 'boolean'],
]);

if (auth()->user()->username !== $validated['username']) {
Expand Down
4 changes: 3 additions & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* @property boolean private_profile
* @property boolean prevent_index
* @property boolean likes_enabled
* @property boolean $experimental
* @property MapProvider mapprovider
* @property int privacy_hide_days
* @property string language
Expand All @@ -50,7 +51,7 @@ class User extends Authenticatable implements MustVerifyEmail
protected $fillable = [
'username', 'name', 'avatar', 'email', 'email_verified_at', 'password', 'home_id', 'privacy_ack_at',
'default_status_visibility', 'likes_enabled', 'private_profile', 'prevent_index', 'privacy_hide_days',
'language', 'last_login', 'mapprovider', 'timezone',
'language', 'last_login', 'mapprovider', 'timezone', 'experimental',
];
protected $hidden = [
'password', 'remember_token', 'email', 'email_verified_at', 'privacy_ack_at',
Expand All @@ -67,6 +68,7 @@ class User extends Authenticatable implements MustVerifyEmail
'home_id' => 'integer',
'private_profile' => 'boolean',
'likes_enabled' => 'boolean',
'experimental' => 'boolean',
'default_status_visibility' => StatusVisibility::class,
'prevent_index' => 'boolean',
'privacy_hide_days' => 'integer',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('experimental')->default(false)->after('likes_enabled');
});
}

public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('experimental');
});
}
};
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"croppie": "^2.6.5",
"leaflet": "^1.9.4",
"Leaflet-MovingMaker": "^0.0.1",
"luxon": "^3.4.3",
"mdb-ui-kit": "^6.4.1",
"notyf": "^3.10.0",
"vue": "^3.3.4"
Expand Down
7 changes: 7 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {Notyf} from 'notyf';
import {createApp} from 'vue';
import NotificationBell from "../vue/components/NotificationBell.vue";
import ActiveJourneyMap from "../vue/components/ActiveJourneyMap.vue";
import Stationboard from "../vue/components/Stationboard.vue";
import StationAutocomplete from "../vue/components/StationAutocomplete.vue";

require("./bootstrap");
require("awesomplete/awesomplete");
Expand All @@ -24,6 +26,11 @@ document.addEventListener("DOMContentLoaded", function () {
app2.component('ActiveJourneyMap', ActiveJourneyMap);
app2.mount('#activeJourneys');

const app3 = createApp({});
app3.component('Stationboard', Stationboard);
app3.component('Stationautocomplete', StationAutocomplete);
app3.mount('#station-board-new');

window.notyf = new Notyf({
duration: 5000,
position: { x: "right", y: "top" },
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@
"settings.prevent-indexing": "Suchmaschinenindexierung verhindern",
"settings.allow": "Erlauben",
"settings.prevent": "Verbieten",
"settings.experimental": "Experimentelle Features",
"settings.experimental.description": "Die experimentellen Features sind noch nicht fertig und können Fehler enthalten. Sie sind nicht für den täglichen Gebrauch geeignet.",
"settings.privacy.update.success": "Deine Privatsphäreneinstellungen wurden aktualisiert.",
"settings.search-engines.description": "Wir setzen ein noindex-Tag auf deinem Profil um den Suchmaschinen mitzuteilen, dass dein Profil nicht indexiert werden darf. Wir haben keinen Einfluss darauf, ob die Suchmaschine diesen Wunsch berücksichtigt.",
"settings.no-tokens": "Es haben aktuell keine externen Anwendungen Zugriff auf deinen Account.",
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@
"settings.prevent-indexing": "Prevent search engine indexing",
"settings.allow": "Allow",
"settings.prevent": "Prevent",
"settings.experimental": "Experimental features",
"settings.experimental.description": "The experimental features are not yet ready and may contain bugs. This is not recommended for daily use.",
"settings.privacy.update.success": "Your privacy settings have been updated.",
"settings.search-engines.description": "We set a noindex tag on your profile to tell the search engines that your profile should not be indexed. We have no influence on whether the search engine takes this wish into account.",
"settings.last-accessed": "Last accessed",
Expand Down
8 changes: 7 additions & 1 deletion resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@
</div>
@endif

@include('includes.station-autocomplete')
@if(auth()->user()->experimental ?? false)
<div id="station-board-new">
<Stationautocomplete :dashboard="true"></Stationautocomplete>
</div>
@else
@include('includes.station-autocomplete')
@endif
@if($future->count() >= 1)
<div class="accordion accordion-flush" id="accordionFutureCheckIns">
<div class="accordion-item">
Expand Down
22 changes: 22 additions & 0 deletions resources/views/settings/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,28 @@ class="form-control"
</div>
</div>

<div class="form-group row">
<label for="experimental" class="col-md-4 col-form-label text-md-right">
{{ __('settings.experimental') }}
<i class="fas fa-info-circle" title="{{__('settings.experimental.description')}}"
data-mdb-toggle="tooltip"></i>
</label>
<div class="col-md-6">
<select class="form-control" name="experimental" id="experimental">
<option value="1" @if(auth()->user()->experimental) selected @endif>
{{__('settings.allow')}}
</option>
<option value="0" @if(!auth()->user()->experimental) selected @endif>
{{__('settings.prevent')}}
</option>
</select>

@error('prevent_index')
<span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
@enderror
</div>
</div>


<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
Expand Down
Loading

0 comments on commit 1bd9881

Please sign in to comment.