-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from COS301-SE-2023/feature/tutorial
Feature/tutorial
- Loading branch information
Showing
24 changed files
with
386 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
frontend/src/app/components/tutorial/tutorial.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<ion-header> | ||
<ion-toolbar class="bar"> | ||
<ion-title>Tutorial</ion-title> | ||
<ion-buttons slot="end"> | ||
<ion-button (click)="closeModal()"> | ||
<ion-icon class="closeButton" slot="icon-only" name="close"></ion-icon> | ||
</ion-button> | ||
</ion-buttons> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content scrollY="false"> | ||
<!-- preferneces,pantr,main,browse,recipe --> | ||
<swiper-container [loop]="false" pagination="true" navigation="true" (slideChange)="onSlideChange()"> | ||
<swiper-slide> | ||
<div class="slide-background"> | ||
<img src="assets/preferences.jpg" alt="Background Image"> | ||
</div> | ||
<button (click)="closeModal()" class="link-button">Skip</button> | ||
</swiper-slide> | ||
<swiper-slide> | ||
<img src="assets/Pantry.jpg"> | ||
|
||
<button (click)="closeModal()" class="link-button">Skip</button> | ||
</swiper-slide> | ||
<swiper-slide> | ||
<img src="assets/Home.jpg"> | ||
<button (click)="closeModal()" class="link-button">Skip</button> | ||
</swiper-slide> | ||
<swiper-slide> | ||
<img src="assets/modal.jpg"> | ||
<button (click)="closeModal()" class="link-button">Skip</button> | ||
</swiper-slide> | ||
<swiper-slide class="swip"> | ||
<video #videoPlayer src="assets/Final.mp4" controls autoplay loop muted></video> | ||
<button (click)="closeModal()" class="link-but">Skip</button> | ||
</swiper-slide> | ||
<swiper-slide> | ||
<img src="assets/Browse.jpg"> | ||
<button (click)="closeModal()" class="link-button">Skip</button> | ||
</swiper-slide> | ||
<swiper-slide> | ||
<img src="assets/Recipe book.jpg"> | ||
<!-- <button (click)="closeModal()" class="link-button">Skip</button> --> | ||
</swiper-slide> | ||
</swiper-container> | ||
|
||
</ion-content> |
125 changes: 125 additions & 0 deletions
125
frontend/src/app/components/tutorial/tutorial.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
swiper-container { | ||
width: 100%; | ||
height: 100%; | ||
// background-image: url('https://unsplash.com/photos/a-dirt-road-in-the-middle-of-a-grassy-field-9BKSdvsRSuA'); | ||
|
||
// background-color: red; | ||
} | ||
|
||
ion-title { | ||
font-size: 20px; | ||
// font-weight: bold; | ||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); | ||
} | ||
|
||
img { | ||
width: 100%; | ||
height: 100%; | ||
background-size: cover; | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.slide-background { | ||
position: relative; | ||
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
} | ||
|
||
|
||
.link-button { | ||
position: fixed; | ||
bottom: 20px; | ||
right: 20px; | ||
font-size: 2.3ch; | ||
color: white; | ||
background: transparent; | ||
font-weight: bold; | ||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); | ||
// background-color: white; | ||
} | ||
.link-but { | ||
position: fixed; | ||
bottom: 20px; | ||
right: 20px; | ||
font-size: 2.5ch; | ||
color: black; | ||
background: transparent; | ||
font-weight: bold; | ||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); | ||
// background-color: white; | ||
} | ||
|
||
|
||
|
||
swiper-slide { | ||
text-align: center; | ||
position: relative; | ||
// font-size: 18px; | ||
// background-color: red; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
swiper-button-next { color: red; } | ||
|
||
.closeButton { | ||
color: white; | ||
// box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); | ||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); | ||
// text-shadow: 2px 2px black; | ||
} | ||
|
||
.bar { | ||
// text-shadow: 2px 2px black; | ||
color:#53BB63; | ||
color: white; | ||
--background: #53BB63; | ||
//font-size: 12px; | ||
// --background: white; | ||
} | ||
|
||
.swiper-pagination-bullet-active { | ||
background-color: #000 !important; | ||
} | ||
|
||
// ion-icon { | ||
// text-shadow: 10px 10px 10px blue; | ||
// } | ||
|
||
.swiper-container .swiper-button-next, | ||
.swiper-container .swiper-button-prev { | ||
background-color: #53BB63; | ||
color: #53BB63; | ||
} | ||
|
||
|
||
video { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: fill; | ||
} | ||
|
||
/* Initial tooltip style, hidden by default */ | ||
.tooltip { | ||
display: none; | ||
position: absolute; | ||
background-color: #333; | ||
color: #fff; | ||
padding: 5px 10px; | ||
border-radius: 5px; | ||
font-size: 14px; | ||
z-index: 9999; | ||
} | ||
|
||
/* Tooltip arrow */ | ||
.tooltip::after { | ||
content: ""; | ||
position: absolute; | ||
top: 100%; | ||
left: 50%; | ||
margin-left: -5px; | ||
border-width: 5px; | ||
border-style: solid; | ||
border-color: #333 transparent transparent transparent; | ||
} |
23 changes: 23 additions & 0 deletions
23
frontend/src/app/components/tutorial/tutorial.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { IonicModule } from '@ionic/angular'; | ||
|
||
import { TutorialComponent } from './tutorial.component'; | ||
|
||
describe('TutorialComponent', () => { | ||
let component: TutorialComponent; | ||
let fixture: ComponentFixture<TutorialComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [IonicModule.forRoot()] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(TutorialComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
88 changes: 88 additions & 0 deletions
88
frontend/src/app/components/tutorial/tutorial.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { Component, ViewChild, ElementRef,OnInit, AfterViewInit , CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; | ||
import { ModalController } from '@ionic/angular'; | ||
import {IonicModule } from '@ionic/angular'; | ||
import { AuthenticationService, ErrorHandlerService } from '../../services/services'; | ||
import { CommonModule } from '@angular/common'; | ||
import Swiper from 'swiper'; | ||
|
||
|
||
@Component({ | ||
|
||
selector: 'app-tutorial', | ||
templateUrl: './tutorial.component.html', | ||
styleUrls: ['./tutorial.component.scss'], | ||
standalone:true, | ||
imports: [CommonModule, IonicModule], | ||
schemas: [CUSTOM_ELEMENTS_SCHEMA], | ||
}) | ||
export class TutorialComponent implements OnInit, AfterViewInit { | ||
|
||
private swiper: Swiper = {} as Swiper; | ||
@ViewChild('swiper') swiperElement!: ElementRef; | ||
@ViewChild('videoPlayer') videoPlayer!: ElementRef; | ||
|
||
constructor(private modalController: ModalController, private errorHandlerService: ErrorHandlerService) { } | ||
|
||
ngOnInit() {} | ||
|
||
ngAfterViewInit() { | ||
//console.log('called'); | ||
this.swiper = new Swiper('.swiper-container', { | ||
// Swiper configuration options | ||
pagination: { | ||
el: '.swiper-pagination', | ||
type: 'progressbar', | ||
}, | ||
navigation: { | ||
nextEl: '.swiper-button-next', | ||
prevEl: '.swiper-button-prev', | ||
}, | ||
on: { | ||
slideChange: () => { | ||
console.log('slides started'); | ||
this.onSlideChange(); | ||
}, | ||
slideChangeTransitionStart: () => { | ||
console.log('transition started'); | ||
this.onSlideChangeTransitionStart(); | ||
}, | ||
}, | ||
}); | ||
// this.swiper.on('slideChange', () => { | ||
// console.log("IN FUNCTION") | ||
// this.onSlideChange(); | ||
// }) | ||
// console.log('done'); | ||
} | ||
|
||
onSlideChange() { | ||
console.log('slide changed'); | ||
//if (this.swiper.isEnd) { | ||
const video: HTMLVideoElement = this.videoPlayer.nativeElement; | ||
const activeSlide = this.swiper.slides[this.swiper.activeIndex]; | ||
if (activeSlide.classList.contains('swip')) { | ||
// If the active slide contains the video, play it | ||
video.play(); | ||
} else { | ||
// If the active slide doesn't contain the video, pause it | ||
video.pause(); | ||
} | ||
//video.pause(); | ||
// } | ||
} | ||
|
||
onSlideChangeTransitionStart() { | ||
console.log('slide started'); | ||
const video: HTMLVideoElement = this.videoPlayer.nativeElement; | ||
video.currentTime = 0; | ||
} | ||
|
||
|
||
onSwiper(swiper: Swiper) { | ||
this.swiper = swiper; | ||
} | ||
|
||
closeModal() { | ||
this.modalController.dismiss(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
.help-button ion-icon { | ||
font-size: 24px; | ||
--border-radius: 0%; | ||
--padding-end: 8px; | ||
font-size: 27px; | ||
} | ||
|
||
.help-button{ | ||
transition: all ease-in-out 0.2s; | ||
cursor: pointer; | ||
border-radius: 30%; | ||
width: 10vw; | ||
} | ||
|
||
.help-button:hover{ | ||
// border: 1px solid #888; | ||
background-color: #ddd; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.