Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move play all clips button to clip info button and create ButtonConnector #187

Merged
merged 4 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 11 additions & 15 deletions src/components/ui/Button.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<div class="btnWrapper">
<button v-if="combinedInfo" id="outlined" class="infoBtn">
<slot></slot>
</button>

<button ref="mainBtn" class="mainBtn">
<div class="content" @[clickEvent]="$emit('click')">
<Icon v-if="icon" :i="icon" />

<span v-if="text">{{ text }}</span>

<div v-if="this.$slots.info" class="infoBtn">
<slot name="info"></slot>
</div>
</div>

<input
Expand All @@ -26,7 +26,7 @@
</template>

<script lang="ts">
import { Prop, Component, Vue } from "vue-property-decorator";
import { Vue, Prop, Component, Watch } from "vue-property-decorator";
import Icon from "./../Icon.vue";

@Component({
Expand All @@ -39,7 +39,6 @@ export default class Button extends Vue {
@Prop() text: string;

@Prop({ default: false }) disabled: boolean;
@Prop() combinedInfo: boolean;
@Prop() outlined: boolean;
@Prop({ default: false }) slider: boolean;
@Prop({ default: 0 }) sliderValue: string;
Expand All @@ -58,22 +57,17 @@ export default class Button extends Vue {
if (this.outlined) this.mainBtn.id += "outlined";
if (this.slider) this.initSlider();

// Run these at mount to match default var values passed
this.handleDisability();
this.updateSliderValue();
}

updated() {
this.handleDisability();

// Update sliderBar value, if slider is enabled and it is updated
this.updateSliderValue();
}

/**
* Manage whether button should be disabled or not.
*/
@Watch("disabled")
handleDisability() {
// Enable/disable button click event
// Enable/disable button click event & `disabled` class
if (this.disabled) {
this.clickEvent = "null";
this.mainBtn.classList.add("disabled");
Expand Down Expand Up @@ -114,6 +108,7 @@ export default class Button extends Vue {
);
}

@Watch("sliderValue")
updateSliderValue() {
if (this.slider && this.sliderBar) {
this.sliderBar.value = String(this.sliderValue);
Expand Down Expand Up @@ -199,7 +194,7 @@ export default class Button extends Vue {
flex-flow: row;
align-items: center;
height: 100%;
padding: 3px;
padding: 3px 5px;
border: unset;
border: 2px solid $secondaryColor;
border-radius: 3px;
Expand All @@ -220,6 +215,7 @@ export default class Button extends Vue {
}

&.disabled {
background-color: $secondaryColor;
cursor: not-allowed;
}

Expand Down
50 changes: 50 additions & 0 deletions src/components/ui/ButtonConnector.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<div class="container">
<slot></slot>
</div>
</template>

<script lang="ts">
import { Vue, Component } from "vue-property-decorator";

@Component
export default class ButtonConnector extends Vue {}
</script>

<style lang="scss" scoped>
.container {
display: flex;
flex-flow: row;
height: 100%;
border: 2px solid $secondaryColor;
border-radius: 3px;

.btnWrapper {
margin-left: 0;

&:first-child:not(:only-child) ::v-deep .mainBtn {
border-right: 2px solid $secondaryColor;
}

&:first-child ::v-deep .mainBtn {
border-left: unset;
border-radius: 3px 0 0 3px;
}

&:last-child ::v-deep .mainBtn {
border-radius: 0 3px 3px 0;
}

::v-deep #outlined {
padding: 5px;
border: unset;
}

::v-deep .mainBtn {
border: unset;
border-left: 2px solid $secondaryColor;
border-radius: unset;
}
}
}
</style>
45 changes: 27 additions & 18 deletions src/views/VideoPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,30 @@
@click="showTimeAsElapsed ? (showTimeAsElapsed = false) : (showTimeAsElapsed = true)"
/>

<Button text="ADD CLIP" @click="addClip" />
<Button text="Add Clip" @click="addClip" />

<Button icon="add" @click="adjustZoom(true)" />
<Button icon="min2" @click="adjustZoom(false)" />

<Button icon="play" text="Play Clips" @click="playClips" />

<div class="rightFromHere"></div>

<Button icon="arrow" :combinedInfo="continueBtnCI" :disabled="!continueBtnCI" @click="saveClips">
<div>
<Icon i="clips" wh="18" />
<span>{{ numberOfClips }}</span>
</div>

<div>
<Icon i="time" wh="18" />
<span>{{ lengthOfClips }}</span>
</div>
</Button>
<ButtonConnector>
<Button :outlined="true" @click="playClips">
<template slot="info">
<div>
<Icon i="clips" wh="18" />
<span>{{ numberOfClips }}</span>
</div>

<div>
<Icon i="time" wh="18" />
<span>{{ lengthOfClips }}</span>
</div>
</template>
</Button>

<Button icon="arrow" :disabled="continueBtnDisabled" @click="saveClips" />
</ButtonConnector>
</div>
</div>
<div v-else>
Expand All @@ -64,6 +68,7 @@
import { Vue, Component, Prop } from "vue-property-decorator";
import Icon from "@/components/Icon.vue";
import Button from "@/components/ui/Button.vue";
import ButtonConnector from "@/components/ui/ButtonConnector.vue";
import "@/libs/helpers/extensions";
import Helpers from "@/libs/helpers";
import RecordingsManager from "@/libs/recorder/recordingsManager";
Expand All @@ -74,7 +79,8 @@ import noUiSlider, { PipsMode, target } from "nouislider";
@Component({
components: {
Icon,
Button
Button,
ButtonConnector
}
})
export default class VideoPlayer extends Vue {
Expand All @@ -90,7 +96,7 @@ export default class VideoPlayer extends Vue {
lengthOfClips = "00:00";
maxVideoTime = 0;
playPauseBtnIcon = "play";
continueBtnCI = false;
continueBtnDisabled = true;
volumeIcon = "volumeMax";
volume = 0.8;
showTimeAsElapsed = false;
Expand Down Expand Up @@ -441,7 +447,7 @@ export default class VideoPlayer extends Vue {
this.createClipsBar(starts, connects, tooltips);

// Show continue button clip info
this.continueBtnCI = true;
this.continueBtnDisabled = false;
}

/**
Expand Down Expand Up @@ -471,11 +477,14 @@ export default class VideoPlayer extends Vue {
// Remove unneeded tooltips
tooltips = tooltips.slice(0, tooltips.length - 2);
} else {
this.continueBtnCI = false;
this.continueBtnDisabled = true;

starts = [];
connects = [];
tooltips = [];

// Reset length of clips
this.updateTotalLengthOfClips([]);
}

this.createClipsBar(starts, connects, tooltips);
Expand Down