Skip to content

Commit

Permalink
Merge pull request #12 from Kubiverse/staging-1.0.7
Browse files Browse the repository at this point in the history
Upgrade to v1.0.7
  • Loading branch information
big213 committed May 23, 2020
2 parents 41e12ac + a71d983 commit d6d646a
Show file tree
Hide file tree
Showing 18 changed files with 422 additions and 87 deletions.
2 changes: 1 addition & 1 deletion components/dialog/misc/editRoomSettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default {
scrambleVisualizationOptions: [
{ text: '2D', value: '2D' },
{ text: '3D (Not available on all puzzles)', value: '3D' },
{ text: '3D (Select Puzzles Only)', value: '3D' },
],
}
},
Expand Down
6 changes: 3 additions & 3 deletions components/interface/viewCuberRoomsInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export default {
}
},
async loadData() {
this.loading.loadData = true
//this.loading.loadData = true
try {
let { data } = await this.$apollo.query({
query: CUBER_ROOMS_QUERY,
Expand All @@ -294,11 +294,11 @@ export default {
} catch (err) {
sharedService.handleError(err, this.$root)
}
this.loading.loadData = false
//this.loading.loadData = false
},
reset(initialLoad = false) {
if (!this.status) return
if (!this.status || !this.cuber) return
if (initialLoad) this.options.initialLoad = true
this.loadData()
Expand Down
41 changes: 40 additions & 1 deletion components/interface/viewCuberSolvesInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
<span :class="{ 'winner-text': item.is_winner }">{{
generateSolveString(item)
}}</span>
<v-icon
v-if="hasEditPermissions"
small
title="Toggle Track"
:color="item.is_tracked ? null : 'error'"
@click.stop="toggleSolveTracked(item)"
>{{ item.is_tracked ? 'mdi-alarm' : 'mdi-alarm-off' }}</v-icon
>
</template>
<template v-slot:item.created_at="{ item }">
{{ generateMomentString(item.created_at) }}
Expand Down Expand Up @@ -52,6 +60,7 @@
<script>
import sharedService from '~/services/shared.js'
import { SOLVES_QUERY } from '~/gql/query/solve.js'
import { UPDATE_SOLVE_MUTATION } from '~/gql/mutation/room.js'
import ViewRoundInterface from '~/components/interface/viewRoundInterface.vue'
import EventLabel from '~/components/shared/eventLabel.vue'
Expand Down Expand Up @@ -138,11 +147,17 @@ export default {
footerOptions: {
'items-per-page-options': [5, 10, 25, 50],
},
loading: {
updateSolve: false,
},
}
},
computed: {
hasEditPermissions() {
return this.$store.getters['auth/user']?.id === this.cuber.id
return (
this.cuber && this.$store.getters['auth/user']?.id === this.cuber?.id
)
},
},
Expand Down Expand Up @@ -204,6 +219,30 @@ export default {
}
},
async toggleSolveTracked(solve) {
this.loading.updateSolve = true
try {
let { data } = await this.$apollo.mutate({
mutation: UPDATE_SOLVE_MUTATION,
variables: {
solve_id: solve.id,
is_tracked: !solve.is_tracked,
},
})
solve.is_tracked = data.updateSolve.is_tracked;
sharedService.generateSnackbar(
this.$root,
'Solve ' + (solve.is_tracked ? 'Re' : 'Un') + '-tracked',
'success',
)
} catch (err) {
sharedService.handleError(err, this.$root)
}
this.loading.updateSolve = false
},
reloadData() {
this.$apollo.queries.solves.refresh()
},
Expand Down
13 changes: 12 additions & 1 deletion components/popover/previewCuberPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
offset-x
>
<template v-slot:activator="{ on }">
<a v-if="selectedItem" v-on="on">
<v-chip v-if="chip && selectedItem" v-on="on">
<v-avatar left>
<v-img v-if="selectedItem.avatar" :src="selectedItem.avatar" />
<v-icon v-else>mdi-account</v-icon>
</v-avatar>
{{ selectedItem.name }}
</v-chip>
<a v-else-if="selectedItem" v-on="on">
<v-avatar size="24" class="mr-1">
<v-img v-if="selectedItem.avatar" :src="selectedItem.avatar" />
<v-icon v-else>mdi-account</v-icon>
Expand Down Expand Up @@ -91,6 +98,10 @@ import {
export default {
props: {
selectedItem: {},
chip: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand Down
1 change: 1 addition & 0 deletions gql/fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ export const solveFragment = gql`
is_dnf
time
is_winner
is_tracked
}
`
27 changes: 24 additions & 3 deletions gql/mutation/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,16 @@ export const DELETE_ROOM_MUTATION = gql`
`

export const JOIN_ROOM_MUTATION = gql`
mutation joinRoom($room_id: ID!, $secret: String) {
joinRoom(id: $room_id, secret: $secret) {
mutation joinRoom(
$room_id: ID!
$secret: String
$participationType: CuberRoomRelationTypeEnum
) {
joinRoom(
id: $room_id
secret: $secret
participationType: $participationType
) {
id
}
}
Expand Down Expand Up @@ -158,10 +166,11 @@ export const INVITE_CUBER_MUTATION = gql`
export const UPDATE_SOLVE_MUTATION = gql`
mutation updateSolve(
$solve_id: ID!
$state: SolveState!
$state: SolveState
$time: Milliseconds
$penalties: Milliseconds
$is_dnf: Boolean
$is_tracked: Boolean
) {
updateSolve(
input: {
Expand All @@ -170,6 +179,7 @@ export const UPDATE_SOLVE_MUTATION = gql`
time: $time
penalties: $penalties
is_dnf: $is_dnf
is_tracked: $is_tracked
}
) {
...Solve
Expand All @@ -181,3 +191,14 @@ export const UPDATE_SOLVE_MUTATION = gql`
${solveFragment}
${cuberBasicFragment}
`

export const CHANGE_ROOM_STATUS_MUTATION = gql`
mutation changeRoomStatus(
$room_id: ID!
$participationType: CuberRoomRelationTypeEnum
) {
changeRoomStatus(room_id: $room_id, participationType: $participationType) {
id
}
}
`
11 changes: 11 additions & 0 deletions gql/query/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ export const ROOM_QUERY = gql`
...CuberBasic
}
active_cubers(first: 10) {
data {
...CuberBasic
pivot {
type
}
}
}
spectating_cubers(first: 10) {
paginatorInfo {
total
}
data {
...CuberBasic
}
Expand Down
3 changes: 3 additions & 0 deletions gql/query/round.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ export const ROUNDS_QUERY = gql`
...Solve
cuber {
...CuberBasic
pivot {
type
}
}
}
accumulated_results {
Expand Down
42 changes: 39 additions & 3 deletions gql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ type Cuber {
first: Int!
page: Int
): CuberPaginator
pivot: CuberRoomPivot
created_at: DateTime!
updated_at: DateTime
}
Expand All @@ -355,6 +356,20 @@ type CuberRoom {
room: Room!
}

type CuberRoomPivot {
type: CuberRoomRelationTypeEnum!
last_activity_at: DateTime!
cuber: Cuber!
room: Room!
}

enum CuberRoomRelationTypeEnum {
VISITED
PARTICIPATING
IDLING
SPECTATING
}

scalar Date

scalar DateTime
Expand Down Expand Up @@ -418,13 +433,20 @@ scalar Milliseconds
type Mutation {
sendRoomChatMessage(room_id: ID!, message: String!): RoomChatMessage!
updateCuber(input: UpdateCuberInput): Cuber!
idle: Cuber
followCuber(id: ID): Cuber
unfollowCuber(id: ID): Cuber
inviteCuber(room_id: ID!, cuber_id: ID!): CuberRoom!
createRoom(input: CreateRoomInput!): Room!
updateRoom(input: UpdateRoomInput!): Room!
joinRoom(id: ID!, secret: String): Room!
joinRoom(
id: ID!
secret: String
participationType: CuberRoomRelationTypeEnum
): Room!
changeRoomStatus(
room_id: ID!
participationType: CuberRoomRelationTypeEnum
): Room!
leaveRoom(id: ID!): Room!
deleteRoom(id: ID!): Room!
untrackSolvesFromRoom(room_id: ID!): [Solve!]
Expand Down Expand Up @@ -573,6 +595,18 @@ type Room {
first: Int!
page: Int
): CuberPaginator
participating_cubers(
first: Int!
page: Int
): CuberPaginator
idling_cubers(
first: Int!
page: Int
): CuberPaginator
spectating_cubers(
first: Int!
page: Int
): CuberPaginator
active_cubers(
first: Int!
page: Int
Expand All @@ -592,6 +626,7 @@ type Room {
is_full: Boolean!
creator: Cuber!
accumulators: [Accumulator!]
pivot: CuberRoomPivot
manager: Cuber
created_at: DateTime!
updated_at: DateTime
Expand Down Expand Up @@ -720,6 +755,7 @@ type Subscription {
roomChatMessageReceived(room_id: ID!): RoomChatMessage
cuberNotificationReceived: CuberNotification
roomMembersUpdated(room_id: ID!): [Cuber!]
roomMemberStatusUpdated(room_id: ID!): CuberRoomPivot
roomUpdated(room_id: ID!): Room
roundStarted(room_id: ID!): Round
roundFinished(room_id: ID!): Round
Expand Down Expand Up @@ -750,7 +786,7 @@ input UpdateRoomInput {

input UpdateSolveInput {
id: ID!
state: SolveState!
state: SolveState
time: Milliseconds
penalties: Milliseconds
is_dnf: Boolean
Expand Down
22 changes: 22 additions & 0 deletions gql/subscription/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export const ROOM_MEMBERS_UPDATED_SUBSCRIPTION = gql`
subscription roomMembersUpdated($room_id: ID!) {
roomMembersUpdated(room_id: $room_id) {
...CuberBasic
pivot {
type
last_activity_at
}
}
}
${cuberBasicFragment}
Expand Down Expand Up @@ -57,6 +61,10 @@ export const ROUND_STARTED_SUBSCRIPTION = gql`
...Solve
cuber {
...CuberBasic
pivot {
type
last_activity_at
}
}
}
accumulated_results {
Expand Down Expand Up @@ -101,3 +109,17 @@ export const SOLVE_UPDATED_SUBSCRIPTION = gql`
${solveFragment}
${cuberBasicFragment}
`

//not real subscription
export const ROOM_MEMBER_STATUS_UPDATED_SUBSCRIPTION = gql`
subscription roomMemberStatusUpdated($room_id: ID!) {
roomMemberStatusUpdated(room_id: $room_id) {
type
last_activity_at
cuber {
...CuberBasic
}
}
}
${cuberBasicFragment}
`
5 changes: 5 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 @@ -28,6 +28,7 @@
"randomstring": "^1.1.5",
"scramble-display": "^0.1.0",
"stackmat": "^1.0.0",
"stackmat-signal-processor": "^0.1.0",
"vue-tour": "^1.3.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit d6d646a

Please sign in to comment.