diff --git a/backend/src/db/seed.js b/backend/src/db/seed.js index 47633b507..685b5ef0e 100644 --- a/backend/src/db/seed.js +++ b/backend/src/db/seed.js @@ -928,7 +928,15 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] trollingComment.update({ disabled: true, updatedAt: new Date().toISOString(), closed: true }), ]) - await Promise.all([...Array(30).keys()].map(() => Factory.build('user'))) + const additionalUsers = await Promise.all( + [...Array(30).keys()].map(() => Factory.build('user')), + ) + await Promise.all( + additionalUsers.map(async (user) => { + await jennyRostock.relateTo(user, 'following') + await user.relateTo(jennyRostock, 'following') + }), + ) await Promise.all( [...Array(30).keys()].map(() => diff --git a/webapp/assets/_new/styles/tokens.scss b/webapp/assets/_new/styles/tokens.scss index 54a8b4042..e87750fb6 100644 --- a/webapp/assets/_new/styles/tokens.scss +++ b/webapp/assets/_new/styles/tokens.scss @@ -230,6 +230,7 @@ $space-small: 16px; $space-x-small: 8px; $space-xx-small: 4px; $space-xxx-small: 2px; +$space-none: 0; /** * @tokens Size Height @@ -240,6 +241,7 @@ $size-height-base: 42px; $size-height-large: 50px; $size-height-xlarge: 60px; $size-height-footer: 64px; +$size-height-connections: 315px; $size-tappable-square: 44px; $size-ribbon: 6px; diff --git a/webapp/components/_new/generic/UserAvatar/UserAvatar.vue b/webapp/components/_new/generic/UserAvatar/UserAvatar.vue index 7dc63f52f..451d7648b 100644 --- a/webapp/components/_new/generic/UserAvatar/UserAvatar.vue +++ b/webapp/components/_new/generic/UserAvatar/UserAvatar.vue @@ -3,9 +3,11 @@ {{ userInitials }} diff --git a/webapp/components/features/FollowList/FollowList.spec.js b/webapp/components/features/FollowList/FollowList.spec.js new file mode 100644 index 000000000..44a855eed --- /dev/null +++ b/webapp/components/features/FollowList/FollowList.spec.js @@ -0,0 +1,150 @@ +import { config, mount } from '@vue/test-utils' +import Vuex from 'vuex' + +import helpers from '~/storybook/helpers' +import FollowList from './FollowList.vue' + +const localVue = global.localVue + +config.stubs['client-only'] = '' +config.stubs['ds-space'] = '' +config.stubs['nuxt-link'] = '' + +const user = { + ...helpers.fakeUser()[0], + followedByCount: 12, + followingCount: 15, + followedBy: helpers.fakeUser(7), + following: helpers.fakeUser(7), +} + +const allConnectionsUser = { + ...user, + followedBy: [ + ...user.followedBy, + ...helpers.fakeUser(user.followedByCount - user.followedBy.length), + ], + following: [...user.following, ...helpers.fakeUser(user.followingCount - user.following.length)], +} + +const noConnectionsUser = { + ...user, + followedByCount: 0, + followingCount: 0, + followedBy: [], + following: [], +} + +describe('FollowList.vue', () => { + let store, getters + const Wrapper = (customProps) => + mount(FollowList, { + store, + propsData: { user, ...customProps }, + mocks: { + $t: jest.fn((str) => str), + }, + localVue, + }) + + beforeAll(() => { + getters = { + 'auth/user': () => { + return {} + }, + 'auth/isModerator': () => false, + } + }) + + describe('mount', () => { + beforeAll(() => { + store = new Vuex.Store({ + getters, + }) + }) + + describe('given a type', () => { + describe('of `following`', () => { + it('uses the `following` data on :user', () => { + const wrapper = Wrapper({ user, type: 'following' }) + wrapper.find('.base-button').trigger('click') + + expect(wrapper.vm.allConnectionsCount).toBe(user.followingCount) + expect(wrapper.findAll('.user-teaser')).toHaveLength(user.following.length) + expect(wrapper.emitted('fetchAllConnections')).toEqual([['following']]) + }) + }) + + describe('of `followedBy`', () => { + it('uses the `followedBy` data on :user', () => { + const wrapper = Wrapper({ type: 'followedBy' }) + wrapper.find('.base-button').trigger('click') + + expect(wrapper.vm.allConnectionsCount).toBe(user.followedByCount) + expect(wrapper.findAll('.user-teaser')).toHaveLength(user.followedBy.length) + expect(wrapper.emitted('fetchAllConnections')).toEqual([['followedBy']]) + }) + }) + }) + + describe('given no type', () => { + it('defaults type to `following`', () => { + const wrapper = Wrapper() + expect(wrapper.text()).toContain('profile.network.following') + }) + }) + + describe('given a user', () => { + describe('without connections', () => { + it('displays the followingNobody message', () => { + const wrapper = Wrapper({ user: noConnectionsUser }) + expect(wrapper.find('.nobody-message').text()).toContain( + 'profile.network.followingNobody', + ) + }) + + it('displays the followedByNobody message', () => { + const wrapper = Wrapper({ user: noConnectionsUser, type: 'followedBy' }) + expect(wrapper.find('.nobody-message').text()).toContain( + 'profile.network.followedByNobody', + ) + }) + }) + + describe('with up to 7 loaded connections', () => { + let wrapper + beforeAll(() => { + wrapper = Wrapper() + }) + + it(`renders the connections`, () => { + expect(wrapper.findAll('.user-teaser')).toHaveLength(user.following.length) + }) + + it(`has a button to load all remaining connections`, async () => { + wrapper.find('.base-button').trigger('click') + expect(wrapper.emitted('fetchAllConnections')).toBeTruthy() + }) + }) + + describe('with more than 7 loaded connections', () => { + let wrapper + beforeAll(() => { + wrapper = Wrapper({ user: allConnectionsUser }) + }) + + it('renders the connections', () => { + expect(wrapper.findAll('.user-teaser')).toHaveLength(allConnectionsUser.followingCount) + }) + + it('renders the user-teasers as an overflowing list', () => { + expect(wrapper.find('.--overflow').is('ul')).toBe(true) + }) + + it('renders a filter text input', () => { + expect(wrapper.find('[name="followingFilter"]').is('input')).toBe(true) + }) + }) + }) + }) +}) diff --git a/webapp/components/features/FollowList/FollowList.story.js b/webapp/components/features/FollowList/FollowList.story.js new file mode 100644 index 000000000..78d895fe9 --- /dev/null +++ b/webapp/components/features/FollowList/FollowList.story.js @@ -0,0 +1,111 @@ +import { storiesOf } from '@storybook/vue' +import { withA11y } from '@storybook/addon-a11y' +import { action } from '@storybook/addon-actions' + +import helpers from '~/storybook/helpers' +import FollowList from './FollowList.vue' + +import fuzzyFilterUser from './FollowList.story.json' + +helpers.init() + +const user = { + name: 'Jenny Rostock', + id: 'u3', + followedByCount: 12, + followedBy: helpers.fakeUser(7), + followingCount: 28, + following: helpers.fakeUser(7), +} + +const lessThanSevenUser = { + ...user, + followedByCount: 3, + followedBy: user.followedBy.slice(0, 3), + followingCount: 3, + following: user.following.slice(0, 3), +} + +const allConnectionsUser = { + ...user, + followedBy: [...user.followedBy, ...helpers.fakeUser(5)], + following: [...user.following, ...helpers.fakeUser(21)], +} + +const noConnectionsUser = { + ...user, + followedBy: [], + followedByCount: 0, + following: [], + followingCount: 0, +} + +storiesOf('FollowList', module) + .addDecorator(withA11y) + .addDecorator(helpers.layout) + .add('without connections', () => { + return { + components: { FollowList }, + store: helpers.store, + data() { + return { user: noConnectionsUser } + }, + template: '', + } + }) + .add('with all connections loaded', () => { + return { + components: { FollowList }, + store: helpers.store, + data() { + return { user: lessThanSevenUser } + }, + + template: '', + } + }) + + .add('with more connections loadable', () => { + return { + components: { FollowList }, + store: helpers.store, + data() { + return { user: { ...user } } + }, + methods: { + fetchAllConnections(type) { + this.user[type] = allConnectionsUser[type] + action('fetchAllConnections')(type, this.user) + }, + }, + template: '', + } + }) + .add('with 1000 connections loaded', () => { + return { + components: { FollowList }, + store: helpers.store, + data() { + return { + user: { + ...user, + followedByCount: 1000, + followingCount: 1000, + followedBy: helpers.fakeUser(1000), + following: helpers.fakeUser(1000), + }, + } + }, + template: '', + } + }) + .add('Fuzzy Filter', () => { + return { + components: { FollowList }, + store: helpers.store, + data() { + return { user: fuzzyFilterUser } + }, + template: '', + } + }) diff --git a/webapp/components/features/FollowList/FollowList.story.json b/webapp/components/features/FollowList/FollowList.story.json new file mode 100644 index 000000000..e3055e6e2 --- /dev/null +++ b/webapp/components/features/FollowList/FollowList.story.json @@ -0,0 +1,519 @@ +{ + "id": "u3", + "slug": "jenny-rostock", + "name": "Jenny Rostock", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/nessoila/128.jpg?random=16aba55f-48c6-4ef5-966a-af0e31693e6a" + }, + "followedByCount": 32, + "followingCount": 31, + "following": [ + { + "id": "8c0b0191-454a-4806-b0c3-1ed1d9dc5416", + "slug": "wanda-stanton-sr", + "name": "Wanda Stanton Sr.", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/nicolasfolliot/128.jpg?random=be2e59fb-f038-44d5-9e21-28fb123e8c7c" + } + }, + { + "id": "6f4fdb51-fe93-4373-bf44-c36ea17f6535", + "slug": "walter-ohara", + "name": "Walter O'Hara", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/mutlu82/128.jpg?random=0866e1b7-8285-4eaf-a4c8-8509bd99f172" + } + }, + { + "id": "20f5080b-1fc2-4c70-94c7-badbe2aa2370", + "slug": "hannah-bradtke", + "name": "Hannah Bradtke", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/Skyhartman/128.jpg?random=c02415a6-1e7e-488a-acb6-47587399ff07" + } + }, + { + "id": "c5d2c492-5b8c-41a5-a9a2-26f8c866a885", + "slug": "georgia-koss-dvm", + "name": "Georgia Koss DVM", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/lvovenok/128.jpg?random=8e1e75b9-5dad-4fc8-9c52-38b89a3e0484" + } + }, + { + "id": "f4c10451-f367-4afb-97fe-e48f60236655", + "slug": "genevieve-aufderhar-v", + "name": "Genevieve Aufderhar V", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/dss49/128.jpg?random=fc59a664-d2b4-4677-81e9-26ed5d4bc37e" + } + }, + { + "id": "df65a474-b661-4fd8-b49f-2d609bfc4089", + "slug": "wanda-gerlach", + "name": "Wanda Gerlach", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/lewisainslie/128.jpg?random=5f0976d5-7871-4606-a416-6b67b0e67c15" + } + }, + { + "id": "5f2b3c14-07fc-4dfa-978e-9bf21d8586d0", + "slug": "roland-kohler", + "name": "Roland Kohler", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/bcrad/128.jpg?random=4f77c5b2-0214-4342-a18e-424787f04896" + } + }, + { + "id": "a2c49c22-940a-4598-8285-b8ebb34bd045", + "slug": "krista-hammes-dvm", + "name": "Krista Hammes DVM", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/sterlingrules/128.jpg?random=28167137-eee4-42e6-98a3-ec9a7d4b9509" + } + }, + { + "id": "da70bae8-daf2-4481-b2db-506d00b73210", + "slug": "miss-lester-kovacek", + "name": "Miss Lester Kovacek", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/stefvdham/128.jpg?random=7de26019-8114-4caa-9aea-2172ae3c537c" + } + }, + { + "id": "868952d8-c5df-4415-a0bb-930acd26749c", + "slug": "teri-stamm-iii", + "name": "Teri Stamm III", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/salimianoff/128.jpg?random=d2305511-39b2-4207-bee6-90799557546e" + } + }, + { + "id": "7a569786-fbb1-4e27-8f2c-38d2a0963b9d", + "slug": "gerardo-batz", + "name": "Gerardo Batz", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/colirpixoil/128.jpg?random=8536b980-103e-4e5e-8141-31142e3c6330" + } + }, + { + "id": "dca673f2-89b8-46cc-a836-2515f319c02f", + "slug": "carlton-botsford", + "name": "Carlton Botsford", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/cocolero/128.jpg?random=3ef57800-7694-4ec4-a9eb-39abca8d59e4" + } + }, + { + "id": "58ba4ab0-990e-4f44-a7a8-42d10962f8b7", + "slug": "edward-boehm", + "name": "Edward Boehm", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/d_nny_m_cher/128.jpg?random=cf3ba671-4564-4dc1-bf94-a5fc3ea4fafa" + } + }, + { + "id": "u4", + "slug": "huey", + "name": "Huey", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/hellofeverrrr/128.jpg?random=46fef3a9-44a0-4784-9854-03be6b3f37e1" + } + }, + { + "id": "40cf7e21-a4dc-4055-a49d-3137c53dd815", + "slug": "ms-laurie-bergnaum", + "name": "Ms. Laurie Bergnaum", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/kohette/128.jpg?random=45516cde-9073-4ceb-8b42-2bdf66a26c67" + } + }, + { + "id": "4c377f54-72c3-4e13-9532-6d0f2278a794", + "slug": "jeffery-waelchi", + "name": "Jeffery Waelchi", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/andresenfredrik/128.jpg?random=b643d8ba-5e49-4854-b2a6-2ff609ffcba0" + } + }, + { + "id": "d861e775-2344-40d5-b6e4-8479e7dbe97f", + "slug": "marvin-gutkowski-iii", + "name": "Marvin Gutkowski III", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/kiwiupover/128.jpg?random=d38c1508-0342-46e0-9ef9-e0fd14b33072" + } + }, + { + "id": "3102346c-ea94-41d3-8474-5241e5e473a6", + "slug": "edmund-rolfson-jr", + "name": "Edmund Rolfson Jr.", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg?random=d6f0804c-f38f-4c8b-821d-27a02373c74e" + } + }, + { + "id": "0290fd5e-7ce8-4d70-8c29-f5ed96bfaa1f", + "slug": "bert-oconner", + "name": "Bert O'Conner", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/mangosango/128.jpg?random=03807c6c-c2f6-4ed3-8433-7a1823079eb0" + } + }, + { + "id": "9fe670ff-1968-4b15-ab80-7adee8173dd8", + "slug": "angela-schiller", + "name": "Angela Schiller", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/dudestein/128.jpg?random=0b511fa4-8603-419a-acf0-2a89bc41a71b" + } + }, + { + "id": "63798c79-2476-4eb8-a09c-167420bd05d7", + "slug": "peggy-carter", + "name": "Peggy Carter", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/uxpiper/128.jpg?random=c4dc0de5-99d7-410d-8088-6a2be8358fe9" + } + }, + { + "id": "4d3fbb67-7ddc-4aa9-96d0-57bb20f95f59", + "slug": "krystal-braun", + "name": "Krystal Braun", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/salvafc/128.jpg?random=1dbd4549-a525-4fa3-be41-15db84ceb41a" + } + }, + { + "id": "bcd5f271-bca5-492e-a6b6-7fd490ac37aa", + "slug": "janet-bruen", + "name": "Janet Bruen", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/yigitpinarbasi/128.jpg?random=3c7ab2c0-8e53-4edb-8c74-fd8cdfae5f8e" + } + }, + { + "id": "38ccbf58-305a-4400-a1e4-785661604d5f", + "slug": "ebony-corwin", + "name": "Ebony Corwin", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/thibaut_re/128.jpg?random=f2137643-6f58-45b8-8266-d1fb893d0528" + } + }, + { + "id": "5137e045-aef0-4ce1-8327-b516a72fffd6", + "slug": "terrell-gorczany", + "name": "Terrell Gorczany", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/jimmuirhead/128.jpg?random=5e61976f-529e-47f2-b4f0-b5e4550942ea" + } + }, + { + "id": "b224eb01-5a71-4126-b811-51b7b35afd51", + "slug": "dr-jamie-romaguera", + "name": "Dr. Jamie Romaguera", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/leonfedotov/128.jpg?random=9179538d-58be-4707-8ad6-485f703bea26" + } + }, + { + "id": "fdbb3e7f-f211-4685-831e-9d7e394b95a1", + "slug": "shannon-schuster", + "name": "Shannon Schuster", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/markretzloff/128.jpg?random=f8a223ff-d49f-499f-a161-350e8078c353" + } + }, + { + "id": "d7ee00ea-5d22-4a1c-8670-7e4d4bd4ebfa", + "slug": "guadalupe-kessler", + "name": "Guadalupe Kessler", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/linux29/128.jpg?random=a87d13e1-ff0e-4a39-a018-e89a04d72572" + } + }, + { + "id": "49b868e3-dba5-48ed-8b6c-e686c70dfcfb", + "slug": "lonnie-rogahn", + "name": "Lonnie Rogahn", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/herbigt/128.jpg?random=fde8a699-624d-4052-96ef-0aaacf217184" + } + }, + { + "id": "fa70eecb-fbae-4133-b447-6c80b335fc01", + "slug": "marcella-ledner", + "name": "Marcella Ledner", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/dawidwu/128.jpg?random=03869abc-1a6b-4f26-8d73-7ba508c148d0" + } + }, + { + "id": "ef4cc540-c784-407f-b646-cff4d8fe666e", + "slug": "darrell-runolfsson", + "name": "Darrell Runolfsson", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/andrewofficer/128.jpg?random=e6c24db9-f1c9-45b5-8507-609fca960e92" + } + } + ], + "followedBy": [ + { + "id": "8c0b0191-454a-4806-b0c3-1ed1d9dc5416", + "slug": "wanda-stanton-sr", + "name": "Wanda Stanton Sr.", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/nicolasfolliot/128.jpg?random=be2e59fb-f038-44d5-9e21-28fb123e8c7c" + } + }, + { + "id": "c5d2c492-5b8c-41a5-a9a2-26f8c866a885", + "slug": "georgia-koss-dvm", + "name": "Georgia Koss DVM", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/lvovenok/128.jpg?random=8e1e75b9-5dad-4fc8-9c52-38b89a3e0484" + } + }, + { + "id": "5f2b3c14-07fc-4dfa-978e-9bf21d8586d0", + "slug": "roland-kohler", + "name": "Roland Kohler", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/bcrad/128.jpg?random=4f77c5b2-0214-4342-a18e-424787f04896" + } + }, + { + "id": "6f4fdb51-fe93-4373-bf44-c36ea17f6535", + "slug": "walter-ohara", + "name": "Walter O'Hara", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/mutlu82/128.jpg?random=0866e1b7-8285-4eaf-a4c8-8509bd99f172" + } + }, + { + "id": "20f5080b-1fc2-4c70-94c7-badbe2aa2370", + "slug": "hannah-bradtke", + "name": "Hannah Bradtke", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/Skyhartman/128.jpg?random=c02415a6-1e7e-488a-acb6-47587399ff07" + } + }, + { + "id": "df65a474-b661-4fd8-b49f-2d609bfc4089", + "slug": "wanda-gerlach", + "name": "Wanda Gerlach", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/lewisainslie/128.jpg?random=5f0976d5-7871-4606-a416-6b67b0e67c15" + } + }, + { + "id": "f4c10451-f367-4afb-97fe-e48f60236655", + "slug": "genevieve-aufderhar-v", + "name": "Genevieve Aufderhar V", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/dss49/128.jpg?random=fc59a664-d2b4-4677-81e9-26ed5d4bc37e" + } + }, + { + "id": "7a569786-fbb1-4e27-8f2c-38d2a0963b9d", + "slug": "gerardo-batz", + "name": "Gerardo Batz", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/colirpixoil/128.jpg?random=8536b980-103e-4e5e-8141-31142e3c6330" + } + }, + { + "id": "da70bae8-daf2-4481-b2db-506d00b73210", + "slug": "miss-lester-kovacek", + "name": "Miss Lester Kovacek", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/stefvdham/128.jpg?random=7de26019-8114-4caa-9aea-2172ae3c537c" + } + }, + { + "id": "a2c49c22-940a-4598-8285-b8ebb34bd045", + "slug": "krista-hammes-dvm", + "name": "Krista Hammes DVM", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/sterlingrules/128.jpg?random=28167137-eee4-42e6-98a3-ec9a7d4b9509" + } + }, + { + "id": "bcd5f271-bca5-492e-a6b6-7fd490ac37aa", + "slug": "janet-bruen", + "name": "Janet Bruen", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/yigitpinarbasi/128.jpg?random=3c7ab2c0-8e53-4edb-8c74-fd8cdfae5f8e" + } + }, + { + "id": "38ccbf58-305a-4400-a1e4-785661604d5f", + "slug": "ebony-corwin", + "name": "Ebony Corwin", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/thibaut_re/128.jpg?random=f2137643-6f58-45b8-8266-d1fb893d0528" + } + }, + { + "id": "d7ee00ea-5d22-4a1c-8670-7e4d4bd4ebfa", + "slug": "guadalupe-kessler", + "name": "Guadalupe Kessler", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/linux29/128.jpg?random=a87d13e1-ff0e-4a39-a018-e89a04d72572" + } + }, + { + "id": "dca673f2-89b8-46cc-a836-2515f319c02f", + "slug": "carlton-botsford", + "name": "Carlton Botsford", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/cocolero/128.jpg?random=3ef57800-7694-4ec4-a9eb-39abca8d59e4" + } + }, + { + "id": "49b868e3-dba5-48ed-8b6c-e686c70dfcfb", + "slug": "lonnie-rogahn", + "name": "Lonnie Rogahn", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/herbigt/128.jpg?random=fde8a699-624d-4052-96ef-0aaacf217184" + } + }, + { + "id": "4d3fbb67-7ddc-4aa9-96d0-57bb20f95f59", + "slug": "krystal-braun", + "name": "Krystal Braun", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/salvafc/128.jpg?random=1dbd4549-a525-4fa3-be41-15db84ceb41a" + } + }, + { + "id": "58ba4ab0-990e-4f44-a7a8-42d10962f8b7", + "slug": "edward-boehm", + "name": "Edward Boehm", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/d_nny_m_cher/128.jpg?random=cf3ba671-4564-4dc1-bf94-a5fc3ea4fafa" + } + }, + { + "id": "868952d8-c5df-4415-a0bb-930acd26749c", + "slug": "teri-stamm-iii", + "name": "Teri Stamm III", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/salimianoff/128.jpg?random=d2305511-39b2-4207-bee6-90799557546e" + } + }, + { + "id": "fa70eecb-fbae-4133-b447-6c80b335fc01", + "slug": "marcella-ledner", + "name": "Marcella Ledner", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/dawidwu/128.jpg?random=03869abc-1a6b-4f26-8d73-7ba508c148d0" + } + }, + { + "id": "63798c79-2476-4eb8-a09c-167420bd05d7", + "slug": "peggy-carter", + "name": "Peggy Carter", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/uxpiper/128.jpg?random=c4dc0de5-99d7-410d-8088-6a2be8358fe9" + } + }, + { + "id": "9fe670ff-1968-4b15-ab80-7adee8173dd8", + "slug": "angela-schiller", + "name": "Angela Schiller", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/dudestein/128.jpg?random=0b511fa4-8603-419a-acf0-2a89bc41a71b" + } + }, + { + "id": "fdbb3e7f-f211-4685-831e-9d7e394b95a1", + "slug": "shannon-schuster", + "name": "Shannon Schuster", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/markretzloff/128.jpg?random=f8a223ff-d49f-499f-a161-350e8078c353" + } + }, + { + "id": "5137e045-aef0-4ce1-8327-b516a72fffd6", + "slug": "terrell-gorczany", + "name": "Terrell Gorczany", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/jimmuirhead/128.jpg?random=5e61976f-529e-47f2-b4f0-b5e4550942ea" + } + }, + { + "id": "ef4cc540-c784-407f-b646-cff4d8fe666e", + "slug": "darrell-runolfsson", + "name": "Darrell Runolfsson", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/andrewofficer/128.jpg?random=e6c24db9-f1c9-45b5-8507-609fca960e92" + } + }, + { + "id": "b224eb01-5a71-4126-b811-51b7b35afd51", + "slug": "dr-jamie-romaguera", + "name": "Dr. Jamie Romaguera", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/leonfedotov/128.jpg?random=9179538d-58be-4707-8ad6-485f703bea26" + } + }, + { + "id": "u1", + "slug": "peter-lustig", + "name": "Peter Lustig", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/timgthomas/128.jpg?random=189d17f8-02d1-4b01-a000-af7121ae6897" + } + }, + { + "id": "u6", + "slug": "louie", + "name": "Louie", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/yayteejay/128.jpg?random=eefe597c-d49a-494f-b311-d6f2645d2264" + } + }, + { + "id": "3102346c-ea94-41d3-8474-5241e5e473a6", + "slug": "edmund-rolfson-jr", + "name": "Edmund Rolfson Jr.", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg?random=d6f0804c-f38f-4c8b-821d-27a02373c74e" + } + }, + { + "id": "40cf7e21-a4dc-4055-a49d-3137c53dd815", + "slug": "ms-laurie-bergnaum", + "name": "Ms. Laurie Bergnaum", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/kohette/128.jpg?random=45516cde-9073-4ceb-8b42-2bdf66a26c67" + } + }, + { + "id": "d861e775-2344-40d5-b6e4-8479e7dbe97f", + "slug": "marvin-gutkowski-iii", + "name": "Marvin Gutkowski III", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/kiwiupover/128.jpg?random=d38c1508-0342-46e0-9ef9-e0fd14b33072" + } + }, + { + "id": "4c377f54-72c3-4e13-9532-6d0f2278a794", + "slug": "jeffery-waelchi", + "name": "Jeffery Waelchi", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/andresenfredrik/128.jpg?random=b643d8ba-5e49-4854-b2a6-2ff609ffcba0" + } + }, + { + "id": "0290fd5e-7ce8-4d70-8c29-f5ed96bfaa1f", + "slug": "bert-oconner", + "name": "Bert O'Conner", + "avatar": { + "url": "https://s3.amazonaws.com/uifaces/faces/twitter/mangosango/128.jpg?random=03807c6c-c2f6-4ed3-8433-7a1823079eb0" + } + } + ] +} + diff --git a/webapp/components/features/FollowList/FollowList.vue b/webapp/components/features/FollowList/FollowList.vue new file mode 100644 index 000000000..633896e08 --- /dev/null +++ b/webapp/components/features/FollowList/FollowList.vue @@ -0,0 +1,165 @@ + + + + + {{ userName | truncate(15) }} {{ $t(`profile.network.${type}`) }} + + + + + + + + {{ + $t('profile.network.andMore', { + number: allConnectionsCount - connections.length, + }) + }} + + + + {{ userName }} {{ $t(`profile.network.${type}Nobody`) }} + + + + + + diff --git a/webapp/graphql/User.js b/webapp/graphql/User.js index aeb6ae729..daf586284 100644 --- a/webapp/graphql/User.js +++ b/webapp/graphql/User.js @@ -14,7 +14,7 @@ export default (i18n) => { ${userCountsFragment} ${locationAndBadgesFragment(lang)} - query User($id: ID!) { + query User($id: ID!, $followedByCount: Int, $followingCount: Int) { User(id: $id) { ...user ...userCounts @@ -26,12 +26,12 @@ export default (i18n) => { isMuted isBlocked blocked - following(first: 7) { + following(first: $followingCount) { ...user ...userCounts ...locationAndBadges } - followedBy(first: 7) { + followedBy(first: $followedByCount) { ...user ...userCounts ...locationAndBadges diff --git a/webapp/pages/profile/_id/_slug.spec.js b/webapp/pages/profile/_id/_slug.spec.js index 0dfc87b85..477174485 100644 --- a/webapp/pages/profile/_id/_slug.spec.js +++ b/webapp/pages/profile/_id/_slug.spec.js @@ -9,6 +9,7 @@ config.stubs['client-only'] = '' config.stubs['v-popover'] = '' config.stubs['nuxt-link'] = '' config.stubs['infinite-loading'] = '' +config.stubs['follow-list'] = '' describe('ProfileSlug', () => { let wrapper diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 2b3ccb888..1a43da14b 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -89,65 +89,19 @@ {{ $t('profile.network.title') }} - - - - {{ userName | truncate(15) }} {{ $t('profile.network.following') }} - - - - - - - - - - - - {{ - $t('profile.network.andMore', { - number: user.followingCount - user.following.length, - }) - }} - - - - - - {{ userName }} {{ $t('profile.network.followingNobody') }} - - - + - - - - {{ userName | truncate(15) }} {{ $t('profile.network.followedBy') }} - - - - - - - - - - - - {{ - $t('profile.network.andMore', { - number: user.followedByCount - user.followedBy.length, - }) - }} - - - - - - {{ userName }} {{ $t('profile.network.followedByNobody') }} - - - + @@ -271,11 +225,11 @@
{{ userName }} {{ $t(`profile.network.${type}Nobody`) }}
- {{ userName }} {{ $t('profile.network.followingNobody') }} -
- {{ userName }} {{ $t('profile.network.followedByNobody') }} -