Basic layout

master
Giò Diani 2024-10-18 17:47:20 +02:00
parent efd6f2e085
commit 1e0693709d
12 changed files with 2042 additions and 8 deletions

View File

@ -7,7 +7,8 @@
"require": {
"php": "^8.2",
"laravel/framework": "^11.9",
"laravel/tinker": "^2.9"
"laravel/tinker": "^2.9",
"survos/wikidata": "^5.0"
},
"require-dev": {
"fakerphp/faker": "^1.23",

243
VANA-php/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7e8c3c14ff33b199b4a0838993eb8423",
"content-hash": "203976b5f6a2ce845933702553914640",
"packages": [
{
"name": "brick/math",
@ -3112,6 +3112,75 @@
],
"time": "2024-04-27T21:32:50+00:00"
},
{
"name": "survos/wikidata",
"version": "5.0.0",
"source": {
"type": "git",
"url": "https://github.com/survos/wikidata.git",
"reference": "3c0910ce79f000c20db215e57d1be39d21e9f3d2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/survos/wikidata/zipball/3c0910ce79f000c20db215e57d1be39d21e9f3d2",
"reference": "3c0910ce79f000c20db215e57d1be39d21e9f3d2",
"shasum": ""
},
"require": {
"illuminate/collections": "^10.0|^11.0",
"php": "^8.2",
"symfony/http-client": "^6.4||^7.0"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.0",
"rector/rector": "^1.1"
},
"type": "library",
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Wikidata\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Arhey",
"role": "developer"
},
{
"name": "tacman",
"role": "developer"
}
],
"description": "A PHP client for working with Wikidata API.",
"homepage": "https://github.com/survos/wikidata",
"keywords": [
"client",
"php",
"wikidata"
],
"support": {
"source": "https://github.com/survos/wikidata/tree/5.0"
},
"funding": [
{
"url": "https://www.buymeacoffee.com/arhey",
"type": "custom"
},
{
"url": "https://www.paypal.me/arhey",
"type": "custom"
}
],
"time": "2024-06-25T19:06:56+00:00"
},
{
"name": "symfony/clock",
"version": "v7.1.1",
@ -3706,6 +3775,178 @@
],
"time": "2024-08-13T14:28:19+00:00"
},
{
"name": "symfony/http-client",
"version": "v7.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "abca35865118edf35a23f2f24978a1784c831cb4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/abca35865118edf35a23f2f24978a1784c831cb4",
"reference": "abca35865118edf35a23f2f24978a1784c831cb4",
"shasum": ""
},
"require": {
"php": ">=8.2",
"psr/log": "^1|^2|^3",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/http-client-contracts": "^3.4.1",
"symfony/service-contracts": "^2.5|^3"
},
"conflict": {
"php-http/discovery": "<1.15",
"symfony/http-foundation": "<6.4"
},
"provide": {
"php-http/async-client-implementation": "*",
"php-http/client-implementation": "*",
"psr/http-client-implementation": "1.0",
"symfony/http-client-implementation": "3.0"
},
"require-dev": {
"amphp/amp": "^2.5",
"amphp/http-client": "^4.2.1",
"amphp/http-tunnel": "^1.0",
"amphp/socket": "^1.1",
"guzzlehttp/promises": "^1.4|^2.0",
"nyholm/psr7": "^1.0",
"php-http/httplug": "^1.0|^2.0",
"psr/http-client": "^1.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/messenger": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/rate-limiter": "^6.4|^7.0",
"symfony/stopwatch": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\HttpClient\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
"homepage": "https://symfony.com",
"keywords": [
"http"
],
"support": {
"source": "https://github.com/symfony/http-client/tree/v7.1.5"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-20T13:35:23+00:00"
},
{
"name": "symfony/http-client-contracts",
"version": "v3.5.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client-contracts.git",
"reference": "20414d96f391677bf80078aa55baece78b82647d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d",
"reference": "20414d96f391677bf80078aa55baece78b82647d",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\HttpClient\\": ""
},
"exclude-from-classmap": [
"/Test/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to HTTP clients",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-04-18T09:32:20+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v7.1.5",

Binary file not shown.

1307
VANA-php/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,5 +9,10 @@
"axios": "^1.7.4",
"laravel-vite-plugin": "^1.0",
"vite": "^5.0"
},
"dependencies": {
"@srgssr/pillarbox-web": "^1.12.2",
"echarts": "^5.5.1",
"gsap": "^3.12.5"
}
}

View File

@ -0,0 +1,233 @@
/* CSS reset by https://piccalil.li/blog/a-more-modern-css-reset/ */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Prevent font size inflation */
html {
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
text-size-adjust: none;
}
/* Remove default margin in favour of better control in authored CSS */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
margin-block-end: 0;
}
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'] {
list-style: none;
}
/* Set core body defaults */
body {
min-height: 100vh;
line-height: 1.5;
margin: 0;
}
/* Set shorter line heights on headings and interactive elements */
h1,
h2,
h3,
h4,
button,
input,
label {
line-height: 1.1;
}
fieldset{
display: block;
border: none;
padding: 0;
margin: 0;
}
/* Balance text wrapping on headings */
h1,
h2,
h3,
h4 {
text-wrap: balance;
}
/* A elements that don't have a class get default styles */
a:not([class]) {
text-decoration-skip-ink: auto;
color: currentColor;
}
/* Make images easier to work with */
img,
picture {
max-width: 100%;
display: block;
}
/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
font-family: inherit;
font-size: inherit;
}
/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
min-height: 10em;
}
/* Anything that has been anchored to should have extra scroll margin */
:target {
scroll-margin-block: 5ex;
}
dl{
display: grid;
grid-template-areas: "title desc" ;
}
.visually-hidden {
position: absolute;
left: -10000px;
top: auto;
width: 1px;
height: 1px;
overflow: hidden;
}
/* Tabs */
.tablist{
height: 100%;
display: grid;
grid-template: "tablist" "panel";
grid-template-rows: 2em 1fr;
}
.controls{
background: #ccc;
}
.control {
display: inline-block;
}
.control label {
padding: .5em 1em;
}
input[type="radio"]:checked + label {
background: #000;
color: #fff;
}
a:focus,
input:focus,
input[type="radio"]:focus + label {
outline: 2px dotted;
outline-offset: 2px;
}
input[type="radio"] + label:hover {
cursor: pointer;
text-decoration: underline;
}
.panel {
background: #eee;
padding: 1em;
}
/* Layout */
main {
width: 100%;
height: 100vh;
display: grid;
grid-template-areas: "video tabs" "timeline timeline";
grid-template-columns: 50% 50%;
grid-template-rows: 50% 50%;
gap: 1em;
}
main>div {
background: purple;
}
#video {
grid-area: video;
}
#tabs {
grid-area: tabs;
}
#timeline {
grid-area: timeline;
position: relative;
}
#timeline-bar{
height: 2em;
margin-left: 20em;
background: #aaa;
}
#timeline-bar-ctrl{
display: inline-block;
background: #000;
width: .1875em;
height: 100%;
position: absolute;
}
#timeline-bar-ctrl::before{
content: '';
width: 2em;
height: 2em;
border-radius: 50%;
transform: translate3d(-50%, 0px, 0px);
background: #000;
position: absolute;
}
#tracks{
height: calc(100% - 2em);
overflow-y: scroll;
}
.track {
background: #ccc;
width: 100%;
min-height: 15em;
display: grid;
grid-template: 100% / 20em 1fr;
}
.track + .track {
border-top: 1px solid #fff;
}
.track-ctrl{
background: #ccc;
}
.track-viz{
background: #eee;
}

View File

@ -1 +1,120 @@
import './bootstrap';
import Pillarbox from '@srgssr/pillarbox-web';
import { gsap } from "gsap";
import { Draggable } from "gsap/Draggable";
import * as echarts from 'echarts';
// Tabs
const tabs = document.querySelectorAll('input[type="radio"]');
tabs.forEach(tab => {
tab.addEventListener('click', el => {
let tabId = el.target.getAttribute('id');
let panels = document.querySelectorAll('.panel');
panels.forEach(p => {
if(p.getAttribute('id') === tabId+'_panel'){
p.hidden = false;
}else{
p.hidden = true;
}
})
})
})
var chartDom = document.querySelectorAll('.track')[0].querySelector('.track-viz');
var myChart = echarts.init(chartDom);
var option;
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line'
}
]
};
option && myChart.setOption(option);
// VIDEO
const video = document.getElementById('video');
// Timeline draggable
gsap.registerPlugin(Draggable);
const status = {
dragging: false
}
document.addEventListener("DOMContentLoaded", (event) => {
gsap.registerPlugin(Draggable)
Draggable.create("#timeline-bar-ctrl", {
type: "x",
bounds: document.getElementById("timeline-bar"),
onDragStart: function () {
//console.log("clicked");
status.dragging = true;
},
onDragEnd: function () {
//console.log("drag ended");
status.dragging = false;
},
});
});
const player = new Pillarbox('my-player', {
controls: false,
muted: true,
srgOptions: {
liveui: false
}
});
player.src({ src: video.getAttribute('data-urn'), type: 'srgssr/urn' });
const timelineBarCtrl = document.getElementById('timeline-bar-ctrl');
function setTimeLine(){
let vidLen = player.duration();
let timeLineLen = document.querySelector('#timeline-bar').offsetWidth;
let position = (timeLineLen / vidLen) * player.currentTime();
timelineBarCtrl.style.transform = `translate3d(${position}px, 0px, 0px)`;
}
/*
document.querySelector('#timeline-bar').addEventListener('click', e => {
let pos = e.clientX - e.target.offsetLeft;
let len = e.target.offsetLeft;
let time = (player.duration() / len) * pos;
player.currentTime(time);
})*/
// Play / Pause video
video.addEventListener('click', _ => {
player.paused() ? player.play() : player.pause();
})
player.on('timeupdate', _ =>{
// console.log(status.dragging);
if(!status.dragging){
setTimeLine();
}
})

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Arenalyse</title>
@vite(['resources/css/app.css', 'resources/js/app.js', 'node_modules/@srgssr/pillarbox-web/dist/pillarbox.min.css'])
</head>
<body>
@yield('body')
</body>
</html>

View File

@ -0,0 +1,96 @@
@extends('base')
@section('body')
<main>
<div id="video" data-urn="{{ $mediacomposition['chapterUrn'] }}">
<video-js id="my-player" class="pillarbox-js" controls></video-js>
</div>
<div id="tabs">
<div class="tablist">
<h1 class="visually-hidden">
Analysen (Tab-Liste)
</h1>
<p class="visually-hidden">
Hilfe zur Tablistensteuerung: Über die Tablistensteuerung kann die Sichtbarkeit der jeweiligen
Tabinhalte umgeschaltet werden, welche sich unterhalb der Tablistensteuerung befinden.
</p>
<fieldset class="controls">
<legend class="visually-hidden">Tablistensteuerung</legend>
<div class="control">
<input checked class="visually-hidden" id="tablist_panel_episode" name="tablist" type="radio" />
<label for="tablist_panel_episode"><span class="visually-hidden">Zeige Tabinhalt
</span>Episode</label>
</div>
<div class="control">
<input class="visually-hidden" id="tablist_panel_transcript" name="tablist" type="radio" />
<label for="tablist_panel_transcript"><span class="visually-hidden">Zeige Tabinhalt
</span>Transkript</label>
</div>
<div class="control">
<input class="visually-hidden" id="tablist_panel_terms" name="tablist" type="radio"
/><label for="tablist_panel_terms"><span
class="visually-hidden">Zeige Tabinhalt
</span>Dokumentbegriffe</label>
</div>
</fieldset>
<div class="panel" id="tablist_panel_episode_panel">
<h2 class="visually-hidden">
Episode (Inhalt)
</h2>
<dl>
<dt>Titel</dt>
<dd>{{ $title }}</dd>
<dt>Lead</dt>
<dd>{{ $mediacomposition['episode']['lead'] }}</dd>
<dt>Publikationsdatum</dt>
<dd>{{ date('d.m.Y H:i', strtotime($mediacomposition['episode']['publishedDate'])) }}</dd>
</dl>
</div>
<div class="panel" id="tablist_panel_transcript_panel" hidden>
<h2 class="visually-hidden">
Transkript (Inhalt)
</h2>
<p>TRANSCRIPT</p>
</div>
<div class="panel" id="tablist_panel_terms_panel" hidden>
<h2 class="visually-hidden">
Begriffe (Tabinhalt)
</h2>
<h3>
Some info about terms
</h3>
<p>
Bla bla bla... all about terms...
</p>
<p>
<img alt="A beautiful terms" src="..." />
</p>
<p>
A link to a page with <a href="#">more infos about terms</a>!
</p>
<h3>
More elements can come here related to terms
</h3>
<p>
Maybe even some form element where you can enter a name for your terms: <input type="text" />
</p>
</div>
</div>
</div>
<div id="timeline">
<div id="timeline-bar">
<div id="timeline-bar-ctrl"></div>
</div>
<div id="tracks">
<div class="track">
<div class="track-ctrl"></div>
<div class="track-viz"></div>
</div>
<div class="track"></div>
<div class="track"></div>
<div class="track"></div>
<div class="track"></div>
</div>
</div>
</main>
@endsection

View File

@ -0,0 +1,8 @@
@extends('base')
@section('body')
<ul>
@foreach ($episodes as $ep)
<li><a href="/detail/{{ $ep->id }}">{{ $ep->title }}</a></li>
@endforeach
</ul>
@endsection

View File

@ -3,12 +3,24 @@
use App\Models\Episode as EpisodeModel;
use App\Subtitles as AppSubtitles;
use Illuminate\Support\Facades\Route;
use App\Srgssr\Episode;
use App\Srgssr\Video;
use App\Srgssr\Subtitles;
use App\Srgssr\Auth;
use Wikidata\Wikidata;
use App\Models\Episode;
Route::get('/', function () {
$episodes = Episode::all();
return view('list', ['episodes' => $episodes]);
});
Route::get('/detail/{id}', function(int $id) {
$ep = Episode::find($id);
$title = $ep->title;
$subtitles = $ep->subtitles;
$mediacomposition = json_decode($ep->mediacomposition, 1);
return view('detail', ['title' => $title, 'subtitles' => $subtitles, 'mediacomposition' => $mediacomposition]);
});

View File

@ -4,7 +4,7 @@ import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
input: ['resources/css/app.css', 'node_modules/@srgssr/pillarbox-web/dist/pillarbox.min.css', 'resources/js/app.js'],
refresh: true,
}),
],