-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(space-users): add user invitation feature
- Loading branch information
1 parent
248426c
commit cc088a0
Showing
8 changed files
with
185 additions
and
13 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/components/space-invitation-form/SpaceInvitationForm.scss
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 @@ | ||
.space-invitation-form { | ||
display: flex; | ||
padding: 0 $spacing-unit/2; | ||
|
||
&__input { | ||
width: 100%; | ||
margin: 0; | ||
} | ||
|
||
.bimdata-btn { | ||
margin: 0 $spacing-unit/3; | ||
} | ||
|
||
&__submit-btn { | ||
color: $color-success; | ||
} | ||
|
||
&__close-btn { | ||
color: $color-high; | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
src/components/space-invitation-form/SpaceInvitationForm.vue
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,93 @@ | ||
<template> | ||
<div class="space-invitation-form"> | ||
<BIMDataInput | ||
ref="emailInput" | ||
class="space-invitation-form__input" | ||
:placeholder="$t('SpaceInvitationForm.inputEmail')" | ||
v-model="email" | ||
:error="error" | ||
:errorMessage="$t('SpaceInvitationForm.errorMessage')" | ||
@keyup.enter.stop="inviteUser" | ||
/> | ||
<BIMDataButton | ||
class="space-invitation-form__submit-btn" | ||
ghost | ||
rounded | ||
icon | ||
@click="inviteUser" | ||
> | ||
<BIMDataIcon name="validate" size="xxs" /> | ||
</BIMDataButton> | ||
<BIMDataButton | ||
class="space-invitation-form__close-btn" | ||
ghost | ||
rounded | ||
icon | ||
@click="close" | ||
> | ||
<BIMDataIcon name="close" size="xxs" /> | ||
</BIMDataButton> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { onMounted, ref } from "vue"; | ||
import { useSpaces } from "@/state/spaces"; | ||
// Components | ||
import BIMDataButton from "@bimdata/design-system/dist/js/BIMDataComponents/vue3/BIMDataButton.js"; | ||
import BIMDataIcon from "@bimdata/design-system/dist/js/BIMDataComponents/vue3/BIMDataIcon.js"; | ||
import BIMDataInput from "@bimdata/design-system/dist/js/BIMDataComponents/vue3/BIMDataInput.js"; | ||
export default { | ||
components: { | ||
BIMDataButton, | ||
BIMDataIcon, | ||
BIMDataInput | ||
}, | ||
props: { | ||
space: { | ||
type: Object, | ||
required: true | ||
} | ||
}, | ||
emits: ["close", "success", "error"], | ||
setup(props, { emit }) { | ||
const { inviteSpaceUser } = useSpaces(); | ||
const emailInput = ref(null); | ||
const email = ref(""); | ||
const error = ref(false); | ||
const inviteUser = () => { | ||
if (email.value) { | ||
inviteSpaceUser(props.space, email.value) | ||
.then(() => emit("success")) | ||
.catch(error => emit("error", error)); | ||
} else { | ||
emailInput.value.focus(); | ||
error.value = true; | ||
} | ||
}; | ||
const close = () => { | ||
error.value = false; | ||
emit("close"); | ||
}; | ||
onMounted(() => { | ||
setTimeout(() => emailInput.value.focus(), 200); | ||
}); | ||
return { | ||
// References | ||
email, | ||
emailInput, | ||
error, | ||
// Methods | ||
close, | ||
inviteUser | ||
}; | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped lang="scss" src="./SpaceInvitationForm.scss"></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
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