-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat(interactables): user picker component #3506
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
51bec14
feat(interactables): add checkbox component
jasonwoodland 20d16b7
feat(interactables): user picker component
jasonwoodland 296086f
feat(quick): use user picker
jasonwoodland 4a9f08c
fix(interactables): button animation speed
jasonwoodland fc53f80
fix(interactables): add missing type
jasonwoodland 1251287
fix(checkbox): style
jasonwoodland 5ab3237
fix(userpicker): typo
jasonwoodland 4f28e90
fix(userpicker): types
jasonwoodland 0d60c4c
style(userpicker): reverse guard clause
jasonwoodland 5aa484d
fix(group): remove z-index
jasonwoodland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export type ButtonType = | ||
| 'primary' | ||
| 'dark' | ||
| 'link' | ||
| 'info' | ||
| 'success' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="checkbox" :class="{checked: value}"> | ||
<check-icon /> | ||
<input type="checkbox" :checked="value" @change="$emit('input', $event.target.checked)"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.checkbox { | ||
width: 20px; | ||
height: 20px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
border: 2px solid @gray; | ||
border-radius: @corner-rounding; | ||
transition: all @animation-speed ease; | ||
|
||
svg, input { | ||
position: absolute; | ||
} | ||
|
||
svg { | ||
transition: all @animation-speed ease; | ||
opacity: 0; | ||
transform: scale(0.5); | ||
stroke: @white; | ||
width: 16px; | ||
height: 16px; | ||
} | ||
|
||
&.checked { | ||
border-color: @flair-color; | ||
background-color: @flair-color; | ||
&:extend(.glow-flair); | ||
|
||
svg { | ||
opacity: 1; | ||
transform: scale(1); | ||
} | ||
} | ||
|
||
input { | ||
appearance: none; | ||
width: 24px; | ||
height: 24px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template src="./Checkbox.html"></template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue' | ||
import { CheckIcon } from 'satellite-lucide-icons' | ||
export default Vue.extend({ | ||
name: 'Checkbox', | ||
components: { | ||
CheckIcon, | ||
}, | ||
props: { | ||
value: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped lang="less" src="./Checkbox.less"></style> |
10 changes: 10 additions & 0 deletions
10
components/interactables/UserPicker/ListItem/ListItem.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="list-item" @click="$emit('click', $event)"> | ||
<UiCircle | ||
:type="src ? 'image' : 'random'" | ||
:seed="friend.address" | ||
:size="32" | ||
:source="src" | ||
/> | ||
<div class="name">{{friend.name}}</div> | ||
<InteractablesCheckbox :value="selected"/> | ||
</div> |
19 changes: 19 additions & 0 deletions
19
components/interactables/UserPicker/ListItem/ListItem.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.list-item { | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-start; | ||
gap: @light-spacing; | ||
cursor: pointer; | ||
padding: @light-spacing; | ||
padding-right: @normal-spacing; | ||
|
||
&:hover { | ||
background: @semitransparent-light-gradient; | ||
} | ||
|
||
.name { | ||
font-size: @mini-text-size; | ||
flex-grow: 1; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template src="./ListItem.html"></template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue' | ||
import { Friend } from '~/types/ui/friends' | ||
export default Vue.extend({ | ||
name: 'ListItem', | ||
props: { | ||
friend: { | ||
type: Object as PropType<Friend>, | ||
required: true, | ||
}, | ||
selected: { | ||
type: Boolean, | ||
default: () => false, | ||
}, | ||
}, | ||
computed: { | ||
src(): string { | ||
const hash = | ||
this.friend?.photoHash || | ||
this.friend?.profilePicture || | ||
this.friend?.request?.userInfo?.photoHash | ||
return hash ? `${this.$Config.textile.browser}/ipfs/${hash}` : '' | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped lang="less" src="./ListItem.less"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="user-picker"> | ||
<InteractablesInput | ||
v-model="filter" | ||
size="small" | ||
type="dark" | ||
:placeholder="$t('servers.create.select_friends_placeholder')" | ||
/> | ||
<UiScroll verticalScroll scrollbarVisibility="scroll" enableWrap> | ||
<InteractablesUserPickerListItem | ||
v-for="friend in filteredFriends" | ||
:friend="friend" | ||
:selected="isSelected(friend)" | ||
@click="toggle(friend)" | ||
/> | ||
</UiScroll> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.user-picker { | ||
height: 200px; | ||
display: flex; | ||
flex-direction: column; | ||
gap: @light-spacing; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template src="./UserPicker.html"></template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue' | ||
import { mapState } from 'vuex' | ||
import { Friend } from '~/types/ui/friends' | ||
import { RootState } from '~/types/store/store' | ||
export default Vue.extend({ | ||
name: 'UserPicker', | ||
data: () => ({ | ||
selected: [] as Friend[], | ||
filter: '', | ||
}), | ||
computed: { | ||
...mapState({ | ||
friends: (state) => (state as RootState).friends.all, | ||
}), | ||
filteredFriends(): Friend[] { | ||
if (!this.filter) { | ||
return this.friends | ||
} | ||
const filterLower = this.filter.toLowerCase() | ||
return this.friends.filter((friend: Friend) => { | ||
return friend.name.toLowerCase().includes(filterLower) | ||
}) | ||
}, | ||
}, | ||
watch: { | ||
selected() { | ||
this.$emit('input', this.selected) | ||
}, | ||
}, | ||
methods: { | ||
toggle(friend: Friend): void { | ||
if (this.isSelected(friend)) { | ||
const index = this.selected.indexOf(friend) | ||
this.selected.splice(index, 1) | ||
return | ||
} | ||
this.selected.push(friend) | ||
}, | ||
isSelected(friend: Friend): boolean { | ||
return this.selected.includes(friend) | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped lang="less" src="./UserPicker.less"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,6 @@ | |
} | ||
|
||
&.unread { | ||
&:extend(.first-layer); | ||
position: relative; | ||
|
||
.label { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is adding a warning when we build locally, could fix you on a separate PR? @jasonwoodland π¨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added ticket here - AP-1766