diff --git a/packages/frontend/src/router/index.js b/packages/frontend/src/router/index.js index a64747803..74c29d49a 100644 --- a/packages/frontend/src/router/index.js +++ b/packages/frontend/src/router/index.js @@ -102,7 +102,7 @@ const routes = [ meta: { title: 'Branch | Speckle' }, - component: () => import('@/views/stream/BranchNew.vue'), + component: () => import('@/views/stream/Branch.vue'), beforeEnter: (to, from, next) => { if (to.params.branchName.toLowerCase() !== to.params.branchName) return next( diff --git a/packages/frontend/src/views/stream/Branch.vue b/packages/frontend/src/views/stream/Branch.vue index 637c48da9..5047a7f4c 100644 --- a/packages/frontend/src/views/stream/Branch.vue +++ b/packages/frontend/src/views/stream/Branch.vue @@ -38,27 +38,120 @@ - - + + + + + + + +
+ +
+
+ +
+ + + + + + + + {{ latestCommit.message }} + + + {{ latestCommit.authorName }} +   + + + + + + +
+
+ + + Older Commits + + + mdi-view-dashboard + mdi-view-list + + + +
+ + + + + + +
+ +
+
+ +
+ + + + + + + + {{ commit.message }} + + + {{ commit.authorName }} +   + + + + + + +
+
+
- - - -
- -
+ - - - - {{ stream.branch.commits.items.length > 1 ? 'Older commits:' : 'No other commits.' }} - - - + +
+ + + + You've reached the end - this branch has no more commits. + + + +
+
+ + + + You've reached the end - this branch has no more commits. + + + +
+
+ + + + + @@ -92,16 +214,22 @@ import branchQuery from '@/graphql/branch.gql' export default { name: 'Branch', components: { + InfiniteLoading: () => import('vue-infinite-loading'), ListItemCommit: () => import('@/components/ListItemCommit'), BranchEditDialog: () => import('@/components/dialogs/BranchEditDialog'), NoDataPlaceholder: () => import('@/components/NoDataPlaceholder'), ErrorPlaceholder: () => import('@/components/ErrorPlaceholder'), + PreviewImage: () => import('@/components/PreviewImage'), + CommitReceivedReceipts: () => import('@/components/CommitReceivedReceipts'), + UserAvatar: () => import('@/components/UserAvatar'), + SourceAppAvatar: () => import('@/components/SourceAppAvatar'), Renderer: () => import('@/components/Renderer') }, data() { return { dialogEdit: false, - error: null + error: null, + listMode: false } }, apollo: { @@ -185,6 +313,39 @@ export default { this.$apollo.queries.stream.refetch() } }) + }, + infiniteHandler($state) { + this.$apollo.queries.stream.fetchMore({ + variables: { + cursor: this.stream.branch.commits.cursor + }, + // Transform the previous result with new data + updateQuery: (previousResult, { fetchMoreResult }) => { + const newItems = fetchMoreResult.stream.branch.commits.items + if (newItems.length === 0) $state.complete() + else $state.loaded() + + return { + stream: { + __typename: previousResult.stream.__typename, + name: previousResult.stream.name, + id: previousResult.stream.id, + branch: { + id: fetchMoreResult.stream.branch.id, + name: fetchMoreResult.stream.branch.name, + description: fetchMoreResult.stream.branch.description, + __typename: previousResult.stream.branch.__typename, + commits: { + __typename: previousResult.stream.branch.commits.__typename, + cursor: fetchMoreResult.stream.branch.commits.cursor, + totalCount: fetchMoreResult.stream.branch.commits.totalCount, + items: [...previousResult.stream.branch.commits.items, ...newItems] + } + } + } + } + } + }) } } } diff --git a/packages/frontend/src/views/stream/BranchNew.vue b/packages/frontend/src/views/stream/BranchNew.vue deleted file mode 100644 index 5047a7f4c..000000000 --- a/packages/frontend/src/views/stream/BranchNew.vue +++ /dev/null @@ -1,361 +0,0 @@ - - -