Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

feature: transfer user card functionality #110

Merged
merged 65 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ed8ae5d
feat(user-card): move user-card component from previuos branch
vberezhnev Sep 25, 2023
091c1f8
fix(docs): change .MD to .md
vberezhnev Sep 25, 2023
176568d
feat(and-more): add new component
vberezhnev Sep 25, 2023
8e8dc27
feat(and-more): add counter
vberezhnev Sep 25, 2023
487843d
feat(and-more): {finaly} add counting of languages
vberezhnev Sep 25, 2023
360157b
fix(user-card): names of files
vberezhnev Sep 27, 2023
463b7e8
fix(user-card & and-more): delete comments
vberezhnev Sep 27, 2023
f032461
fix(user-card): move inline styles to separate file
vberezhnev Sep 28, 2023
5e93b35
fix(user-card): change props using + minor changes
vberezhnev Sep 28, 2023
c02aa51
feat(user-card): move 'and-more' feature to badge-framework component
vberezhnev Sep 28, 2023
2715f6e
feat(user-card): move 'and-more' feature to badge-languages component
vberezhnev Sep 28, 2023
fa277b8
fix(user-card): and-more button size in badge-framework component
vberezhnev Sep 28, 2023
775aaf4
fix(user-card): displaying of 2 languages
vberezhnev Sep 28, 2023
ec9deae
fix(and-more): delete unused component
vberezhnev Sep 29, 2023
6fc9916
fix(user-card): use css variables
vberezhnev Sep 29, 2023
caf775e
fix(user-card): delete inline styles and move to scss file
vberezhnev Sep 29, 2023
17300bf
fix(badge-framework): replace img tag with Image
vberezhnev Sep 29, 2023
c2e1852
refactor(user-card): new polymorphic function to use render badges
vberezhnev Oct 2, 2023
d6508f1
fix(user-card): all problems
vberezhnev Oct 14, 2023
6d83f65
fix(user-card): delete unused part of code
vberezhnev Oct 14, 2023
fbe3f25
fix(user-card): linter
vberezhnev Oct 14, 2023
8db2df8
fix(user-card): fix placement of elements
vberezhnev Oct 16, 2023
e96473c
feat(user-card): crown for leaders
vberezhnev Oct 18, 2023
c69f37b
feat: add new logic for render langs and frameworks
velenyx Oct 18, 2023
6ee88b5
refactor: refactor
velenyx Oct 18, 2023
9639915
refactor: refactor
velenyx Oct 18, 2023
e5db86d
refactor: refactor
velenyx Oct 18, 2023
e56c4ad
refactor: refactor
velenyx Oct 18, 2023
bd69191
refactor: refactor scss
velenyx Oct 18, 2023
7908fe1
refactor: refactor
velenyx Oct 18, 2023
3092e37
refactor: refactor
velenyx Oct 18, 2023
4977a4e
feat: :sparkles: add animation for crown
velenyx Oct 18, 2023
08da10c
feat: :sparkles: add animation for card
velenyx Oct 18, 2023
70d0b28
feat: :sparkles: add types
velenyx Oct 18, 2023
7cfd115
feat: :sparkles: add types
velenyx Oct 18, 2023
da348f8
feat: :sparkles: add @teameights/types
velenyx Oct 18, 2023
6c4a743
Delete node_modules directory
velenyx Oct 18, 2023
b138dde
fix: save changes
velenyx Oct 18, 2023
122eb89
fix: fix css
velenyx Oct 18, 2023
560da38
refactor: refactor
velenyx Oct 18, 2023
8f2023d
refactor: refactor
velenyx Oct 18, 2023
7becaa4
fix(user-card): crown
vberezhnev Oct 21, 2023
a79fd1e
feat(user-card): hover effect
vberezhnev Oct 21, 2023
8203441
feat(user-card): use entities instead of widgets
vberezhnev Oct 21, 2023
7abf623
feat(user-card): add controller for storybook
vberezhnev Oct 21, 2023
e8f3fca
feat(user-card): storybook params
vberezhnev Oct 21, 2023
52c2820
feat(user-card): add onClick param for useCallback hooks
vberezhnev Oct 22, 2023
9c87beb
save changes
velenyx Nov 18, 2023
e9d06a5
feat(user-card): adjust badgeFrameworkLayoutConfig and Image componen…
velenyx Nov 18, 2023
944f421
feat(user-card): add hover effect and cursor pointer to user card com…
velenyx Nov 18, 2023
ffb852d
feat(user-card): add hover effect and cursor pointer to user card com…
velenyx Nov 18, 2023
876e910
feat(user-card): update UserCard component to display user's date of …
velenyx Nov 18, 2023
c3f0381
feat(user-card): use generateMockUser function for default user in Us…
velenyx Nov 18, 2023
8c4b37a
feat(user-card): update generateMockFileEntity to include random quer…
velenyx Nov 18, 2023
21499fd
feat(user-card): calculate and display user's age in UserCard compone…
velenyx Nov 18, 2023
fd7d19a
feat(user-card): add new mock data generation functions and update Ho…
velenyx Nov 18, 2023
8e1ddca
feat(user-card): update file paths and import styles to use consisten…
velenyx Nov 18, 2023
4b45700
feat(user-card): add new logic for render langs and frameworks 🌐✨
velenyx Nov 18, 2023
7738832
fix
velenyx Nov 18, 2023
fa2607e
fix
velenyx Nov 18, 2023
b7d84f8
feat(user-card): restyle badge-language
pupixipup Dec 5, 2023
56d06a0
Merge branch 'develop' into feature/transfer-user-card-functionality
pupixipup Dec 8, 2023
9ce092e
fix: adjust code to changes from merge
pupixipup Dec 8, 2023
8e21160
fix(user-card): update user for storybook to match user type
pupixipup Dec 8, 2023
1cb6152
feat(user-card): add country flag icon
pupixipup Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ on:

jobs:
pipeline:
# Exclude renovate[bot] from triggering the workflow
if: github.actor != 'renovate[bot]'
runs-on: ubuntu-latest
strategy:
Expand All @@ -29,20 +28,14 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}

- name: Cache Yarn dependencies
uses: actions/[email protected]
with:
path: ./client/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('./client/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: 'yarn'
cache-dependency-path: ./client/yarn.lock

- name: Install yarn and dependencies
working-directory: ./client
run: |
npm install --global yarn
yarn install --frozen-lockfile
yarn install --immutable

- name: Lint and Format
working-directory: ./client
Expand All @@ -52,8 +45,7 @@ jobs:

- name: Unit testing 💀💀
working-directory: ./client
run: |
yarn test:unit
run: yarn test:unit

- name: Build project
working-directory: ./client
Expand Down
2 changes: 1 addition & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

node_modules
.idea
.vscode
/storybook-static
Expand Down
5 changes: 1 addition & 4 deletions client/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ const path = require('path');

module.exports = {
images: {
domains: ['picsum.photos', 'source.unsplash.com'],
remotePatterns: [
{
protocol: 'https',
hostname: 's3.amazonaws.com',
port: '',
pathname: '/my-bucket/**',
},
{
protocol: 'https',
hostname: 'picsum.photos',
},
{
protocol: 'https',
hostname: 'flagcdn.com',
Expand Down
6 changes: 6 additions & 0 deletions client/src/app/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,22 @@
--font-body-size-s: 14px;
--font-body-line-s: 120%;
--font-body-weight-s: 400;
--font-body-s: var(--font-body-weight-s) var(--font-body-size-s) / var(--font-body-line-s)
var(--font-rubik);

/* Body 2 -> Body M */
--font-body-size-m: 16px;
--font-body-line-m: 140%;
--font-body-weight-m: 400;
--font-body-m: var(--font-body-weight-s) var(--font-body-size-m) / var(--font-body-line-m)
var(--font-rubik);

/* Body 1 -> Body XL */
--font-body-size-l: 20px;
--font-body-line-l: 140%;
--font-body-weight-l: 400;
--font-body-l: var(--font-body-weight-l) var(--font-body-size-l) / var(--font-body-line-l)
var(--font-rubik);

/* Caption font */
--font-caption-size: 12px;
Expand Down
1 change: 1 addition & 0 deletions client/src/entities/user/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { UserCard } from './ui/user-card/user-card';
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type BadgeFrameworkType = 'full' | 'half' | 'empty' | 'extra';
type BadgeFrameworkLayout = BadgeFrameworkType[];

interface badgeFrameworkLayoutConfig {
readonly default: Readonly<BadgeFrameworkLayout>;

readonly [badgeCount: number]: Readonly<BadgeFrameworkLayout>;
}

export const badgeFrameworkLayoutConfig: badgeFrameworkLayoutConfig = {
1: ['empty', 'full'],
2: ['full', 'full'],
3: ['half', 'half', 'full'],
4: ['half', 'half', 'half', 'half'],
default: ['half', 'half', 'half', 'extra'],
} as const;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import styles from '../user-card/user-card.module.scss';
import { BadgeText } from '@/shared/ui';
import { badgeFrameworkLayoutConfig } from './frameworks-layout-config';

type BadgeFrameworksProps = {
frameworks: string[];
};

export const BadgeFrameworksLayout: React.FC<BadgeFrameworksProps> = ({ frameworks }) => {
const layout =
badgeFrameworkLayoutConfig[frameworks.length] || badgeFrameworkLayoutConfig.default;

const isOneFramework = frameworks.length === 1;

return (
<div className={styles.badgeContainer}>
{layout.map((size, index) => (
<BadgeText
className={styles[size]}
data={
size === 'extra' ? `+${frameworks.length - 3}` : frameworks[isOneFramework ? 0 : index]
}
key={frameworks[index]}
/>
))}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type LanguageType = 'single' | 'more' | 'empty';
type LanguageLayout = LanguageType[];

interface LanguageLayoutConfig {
readonly default: Readonly<LanguageLayout>;

readonly [languageCount: number]: Readonly<LanguageLayout>;
}

export const languageLayoutConfig: LanguageLayoutConfig = {
1: ['single', 'empty'],
2: ['single', 'single'],
3: ['single', 'more'],
default: ['single', 'more'],
} as const;
20 changes: 20 additions & 0 deletions client/src/entities/user/ui/language-layout/language-layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import styles from '../user-card/user-card.module.scss';
import { BadgeIcon } from '@/shared/ui';
import { languageLayoutConfig } from './language-layout-config';

interface ProgrammingLanguagesProps {
languages: string[];
}

export const ProgrammingLanguagesLayout: React.FC<ProgrammingLanguagesProps> = ({ languages }) => {
const layout = languageLayoutConfig[languages.length] || languageLayoutConfig.default;

return (
<div className={styles.languagesContainer}>
{layout.map((type, index) => {
if (type === 'more') return <BadgeIcon key={index} data={`+${languages.length - 1}`} />;
return languages[index] && <BadgeIcon key={languages[index]} data={languages[index]} />;
})}
</div>
);
};
121 changes: 121 additions & 0 deletions client/src/entities/user/ui/user-card/user-card.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
@keyframes pulse {
0% {
transform: rotate(30deg) scale(1);
}
50% {
transform: rotate(30deg) scale(1.1);
}
100% {
transform: rotate(30deg) scale(1);
}
}

.card {
padding: 20px;
position: relative;
border-radius: 15px;
width: 100%;
max-width: 230px;
height: 280px;
background: var(--cards-color);
cursor: pointer;
box-sizing: border-box;
border: 1px solid transparent;
transition: all 0.25s ease;
transition-property: border, background, box-shadow;

&:hover {
border: 1px solid rgba(188, 202, 235, 0.4);
background: linear-gradient(
126deg,
rgba(184, 197, 229, 0.16) 10.31%,
rgba(188, 202, 235, 0.08) 91.99%
);
box-shadow: var(--usercard-shadow);
}
}

.header {
display: flex;
align-items: center;
}

.avatar {
position: relative;

.image {
border-radius: 5px;
}

.crown {
position: absolute;
top: -15%;
right: -15%;
transform: rotate(30deg);
animation: pulse 2s infinite;
}
}

.languagesContainer {
display: flex;
gap: 10px;
width: 100%;
justify-content: flex-end;
align-items: center;
align-self: stretch;
}

.content {
padding-top: 16px;
padding-bottom: 20px;
display: flex;
flex-direction: column;
column-gap: 8px;

.name {
font: var(--font-body-m);
display: flex;
align-items: center;
gap: 8px;
}

.role {
font: var(--font-body-s);
color: var(--grey-normal-color);
flex-basis: 34px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}

.badgeContainer {
display: flex;
flex-wrap: wrap;
align-self: stretch;
height: 74px;
gap: 10px;
}

.empty {
visibility: hidden;
}

.full,
.framework {
flex: 1 1 100%;
}

.half {
flex: 1 1 calc(50% - 10px);
}

.extra {
flex: 1 1 calc(50% - 10px);
background: var(--grey-dark-color);
display: flex;
justify-content: center;
align-items: center;
border-radius: 5px;
}
91 changes: 91 additions & 0 deletions client/src/entities/user/ui/user-card/user-card.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import type { Meta, StoryObj } from '@storybook/react';
import { UserCard } from './user-card';
import { IUserResponse } from '@teameights/types';
import { generateMockUser } from '@/shared/lib/mock';

const defaultUser = generateMockUser();

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta: Meta<typeof UserCard> = {
title: 'entities/User/UserCard',
component: UserCard,
tags: ['autodocs'],
argTypes: {
user: {
photo: { control: 'text' },
fullName: { control: 'text' },
programmingLanguages: { control: 'array' },
frameworks: { control: 'array' },
isLeader: { control: 'boolean' },
},
},
};
export default meta;
type Story = StoryObj<typeof UserCard>;

export const UserCardPreview: Story = {
args: {
user: defaultUser,
},
};

const user1 = {
...defaultUser,
skills: { programmingLanguages: ['JavaScript'], frameworks: ['Node.js'] },
isLeader: true,
} as unknown as IUserResponse;
export const UserCard_1variant = () => <UserCard user={user1} />;

const user2 = {
...defaultUser,
skills: {
programmingLanguages: ['JavaScript', 'TypeScript'],
frameworks: ['Node.js', 'React.js'],
},
isLeader: true,
} as unknown as IUserResponse;
export const UserCard_2variant = () => <UserCard user={user2} />;

const user3 = {
...defaultUser,
skills: {
programmingLanguages: ['JavaScript', 'TypeScript', 'Rust'],
frameworks: ['Node.js', 'React.js', 'MUI'],
},
isLeader: true,
} as unknown as IUserResponse;
export const UserCard_3variant = () => <UserCard user={user3} />;

const user4 = {
...defaultUser,
skills: {
programmingLanguages: ['JavaScript', 'TypeScript', 'Rust', 'Java'],
frameworks: ['Node.js', 'React.js', 'MUI', 'Vue.js'],
},
isLeader: true,
} as unknown as IUserResponse;
export const UserCard_4variant = () => <UserCard user={user4} />;

const user5 = {
...defaultUser,
skills: {
programmingLanguages: ['JavaScript', 'TypeScript', 'Rust', 'Java', 'PHP'],
frameworks: ['Node.js', 'React.js', 'MUI', 'Vue.js', 'Angular'],
},
isLeader: true,
} as unknown as IUserResponse;
export const UserCard_5variant = () => <UserCard user={user5} />;

const userWithoutPhoto = {
...defaultUser,
skills: {
programmingLanguages: ['JS', 'TS', 'Rust', 'Java', 'Php'],
frameworks: ['Node.js', 'React.js', 'MUI', 'Vue.js', 'Angular'],
},
fullName: 'John Doe',
isLeader: true,
} as unknown as IUserResponse;

userWithoutPhoto.photo = null;

export const UserCardWithImageFallback = () => <UserCard user={userWithoutPhoto} />;
Loading
Loading