Skip to content

Commit

Permalink
Merge pull request #117 from Cogapp/feature/custom-tours
Browse files Browse the repository at this point in the history
Custom Tours Sprint 1
  • Loading branch information
nikhiltri authored Oct 25, 2023
2 parents 8ba27f0 + 40770c7 commit 39dcf93
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 3,033 deletions.
5 changes: 5 additions & 0 deletions app/Http/Controllers/CustomTourController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ public function show($id)

return view('site.customTour', ['id' => $customTourItem->id, 'custom_tour' => $customTour]);
}

public function showCustomTourBuilder()
{
return view('site.customTourBuilder');
}
}
76 changes: 76 additions & 0 deletions database/seeders/CustomTourSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

namespace Database\Seeders;

use App\Models\CustomTour;
use Illuminate\Database\Seeder;

class CustomTourSeeder extends Seeder
{
public function run(): void
{
// Custom Tour - Complete Content
$tourJson = [
"title" => "Custom Tour - Complete Content",
"description" => "My custom tour description",
"artworks" => [
[
"id" => 656,
"title" => "Lion (One of a Pair, South Pedestal)",
"objectNote" => "Note about Lion (One of a Pair, South Pedestal)",
],
[
"id" => 28560,
"title" => "The Bedroom",
"objectNote" => "Note about The Bedroom",
],
[
"id" => 117266,
"title" => "Nightlife",
"objectNote" => "Note about Nightlife",
],
[
"id" => 24306,
"title" => "Blue and Green Music",
"objectNote" => "Note about Blue and Green Music",
],
[
"id" => 64818,
"title" => "Stacks of Wheat (End of Summer)",
"objectNote" => "Note about Stacks of Wheat (End of Summer)",
],
],
];

$customTour = new CustomTour();
$customTour->tour_json = json_encode($tourJson);
$customTour->save();

// Custom Tour - No Description
$tourJson = [
"title" => "Custom Tour - No Description",
"description" => "",
"artworks" => [
[
"id" => 117266,
"title" => "Nightlife",
"objectNote" => "Note about Nightlife",
],
[
"id" => 24306,
"title" => "Blue and Green Music",
"objectNote" => "Note about Blue and Green Music",
],
[
"id" => 64818,
"title" => "Stacks of Wheat (End of Summer)",
"objectNote" => "Note about Stacks of Wheat (End of Summer)",
],
],
];

$customTour = new CustomTour();
$customTour->tour_json = json_encode($tourJson);
$customTour->save();
}
}
1 change: 1 addition & 0 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class DatabaseSeeder extends Seeder
HomePageSeeder::class,
VisitPageSeeder::class,
IlluminateTagSeeder::class,
CustomTourSeeder::class,
];

public function run(): void
Expand Down
1 change: 1 addition & 0 deletions frontend/a17-script/gulp/gulp_tasks/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = function(gulp, data, util, taskName) {
collectionSearch: scriptsPath + 'collectionSearch.js',
videojs: scriptsPath + 'videojs.js',
recaptcha: scriptsPath + 'recaptcha.js',
customTourBuilder: scriptsPath + 'customTourBuilder.js',
},
stats: {
errorDetails: true,
Expand Down
25 changes: 25 additions & 0 deletions frontend/js/behaviors/customTourBuilder/customTourBuilder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import ReactDOM from 'react-dom';
import React from 'react';
import CustomTourBuilder from 'custom-tour-builder';

export default function customTourBuilder(container) {
this.init = function () {
ReactDOM.render(
<CustomTourBuilder
initMessage="Custom Tour Builder will render here!"
/>,
container,
() => {
// This is informed by where I think the header scroll hiding is happening
// See: frontend/js/functions/core/setScrollDirection.js
// Catch if the scroll is below the threshold and remove the class
if (window.scrollY < 100) {
document.documentElement.classList.remove('s-header-hide');
}
}
);
}
this.destroy = function () {
ReactDOM.unmountComponentAtNode(container);
}
}
1 change: 1 addition & 0 deletions frontend/js/behaviors/customTourBuilder/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as customTourBuilder } from './customTourBuilder';
6 changes: 6 additions & 0 deletions frontend/js/customTourBuilder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { manageBehaviors } from '@area17/a17-helpers';
import * as Behaviors from './behaviors/customTourBuilder';

document.addEventListener('DOMContentLoaded', function() {
manageBehaviors(Behaviors);
});
Loading

0 comments on commit 39dcf93

Please sign in to comment.