Skip to content
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

Accounts and settings: bug fixes and User Guide fill-in. #889

Merged
merged 7 commits into from
Dec 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 11 additions & 6 deletions src/components/SiteSettings/UserManagment/UserList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ListItemText,
Typography,
} from "@material-ui/core";
import { DeleteForever } from "@material-ui/icons";
import { DeleteForever, VpnKey } from "@material-ui/icons";
import * as React from "react";
import {
LocalizeContextProps,
Expand Down Expand Up @@ -99,11 +99,16 @@ class UserList extends React.Component<
style={{ marginRight: theme.spacing(1) }}
/>
<ListItemText primary={`${user.name} (${user.username})`} />
{user.id !== this.state.currentUserId && (
<Button onClick={() => this.props.handleOpenModal(user)}>
<DeleteForever />
</Button>
)}
{user.id !== this.state.currentUserId &&
(user.isAdmin ? (
<Button disabled>
<VpnKey />
</Button>
) : (
<Button onClick={() => this.props.handleOpenModal(user)}>
<DeleteForever />
</Button>
))}
</ListItem>
))}
</List>
Expand Down
8 changes: 4 additions & 4 deletions src/components/UserSettings/AvatarUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from "react";
import { Grid, Typography } from "@material-ui/core";
import React, { useState } from "react";
import { Translate } from "react-localize-redux";

import { uploadAvatar, avatarSrc } from "../../backend";
import { avatarSrc, uploadAvatar } from "../../backend";
import { getUserId, setAvatar } from "../../backend/localStorage";
import FileInputButton from "../Buttons/FileInputButton";
import LoadingDoneButton from "../Buttons/LoadingDoneButton";
import { getUserId, setAvatar } from "../../backend/localStorage";

/**
* Allows the current user to select an image and upload as their avatar
Expand Down Expand Up @@ -58,7 +58,7 @@ export default function AvatarUpload(props: { doneCallback?: () => void }) {
<Grid item>
<FileInputButton
updateFile={(file) => updateFile(file)}
accept=".jpg"
accept="image/*"
>
<Translate id="buttons.browse" />
</FileInputButton>
Expand Down
25 changes: 19 additions & 6 deletions src/components/UserSettings/UserSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from "@material-ui/core";
import { CameraAlt, Email, Person, Phone } from "@material-ui/icons";

import { updateUser } from "../../backend";
import { isEmailTaken, updateUser } from "../../backend";
import {
getAvatar,
getCurrentUser,
Expand Down Expand Up @@ -123,13 +123,26 @@ class UserSettings extends React.Component<
} as Pick<UserSettingsState, K>);
}

isEmailOkay() {
const emailUnchanged =
this.state.email.toLowerCase() === this.state.user.email.toLowerCase();
return emailUnchanged || !isEmailTaken(this.state.email);
}

onSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
let newUser: User = this.state.user;
newUser.name = this.state.name;
newUser.phone = this.state.phone;
newUser.email = this.state.email;
updateUser(newUser).then((user: User) => setCurrentUser(user));
if (this.isEmailOkay()) {
let newUser: User = this.state.user;
newUser.name = this.state.name;
newUser.phone = this.state.phone;
newUser.email = this.state.email;
updateUser(newUser).then((user: User) => {
setCurrentUser(user);
alert(this.props.translate("userSettings.updateSuccess"));
});
} else {
alert(this.props.translate("login.emailTaken"));
}
}

render() {
Expand Down
7 changes: 7 additions & 0 deletions src/resources/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@
]
}
},
"userSettings": {
"updateSuccess": [
"Settings successfully updated.",
"Settings successfully updated.",
"Settings successfully updated."
]
},
"projectExport": {
"downloadReady": ["Download ready", "Download ready", "Download ready"],
"exportFailed": ["Export failed", "Export failed", "Export failed"],
Expand Down
33 changes: 33 additions & 0 deletions user_guide/docs/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,41 @@

How to register, login, and edit your account.

![Login](images/login.png)

## Register

To create a new account, click the REGISTER button on the Login page.

!!! note

The email address is used to reset your password, so there is only one account allowed per email address.

## Login

Login to The Combine with the username and password given at registration.

If you want to change your password, click the "Forget password?" link. Follow the instructions and a password-reset
will be sent to the email address associated with your account.

!!! important

The username and email address are **not** case-sensitive. The password **is** case-sensitive.

## Settings

After login, there is a blue App Bar along the top of The Combine. Click on the avatar icon at the right end of the App
Bar to open the User Menu. Select "User Settings" to change account/profile settings.

![User Menu](images/userMenu.png)

You can add or update your:

- avatar image;
- name;
- phone number;
- email address.

!!! note

The username chosen at registration is permanent and cannot be changed.
10 changes: 9 additions & 1 deletion user_guide/docs/admin.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Administration / Site Settings

Site administrators have one more option in the User Menu: "Site Settings"
Site administrators have one more option in the User Menu: "Site Settings".

![User Menu - Admin](images/userMenuAdmin.png)

## Project Managements

Administrators can export or archive/restore any project. Archiving a project makes it invisible and unaccessible to all
users, even the project creator, but any admin can restore the project. There is at present no way to permanently delete
a project.

## User Management

Administrators can delete any non-admin user account. To add or remove admin users, please contact the site owner.
Binary file added user_guide/docs/images/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user_guide/docs/images/projectCreateTzotzil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user_guide/docs/images/userMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user_guide/docs/images/userMenuAdmin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion user_guide/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Overview

The Combine is a tool for supporting the rapid word collection workshop and post workshop clean-up.
The Combine is a tool for supporting
[Rapid Word Collection](https://www.sil.org/dictionaries-lexicography/rapid-word-collection-methodology) (RWC) workshops
and post workshop data clean-up.

## Getting Started

Expand Down
19 changes: 16 additions & 3 deletions user_guide/docs/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@ A project is for a single vernacular language.

## Create a Project

![Create Project - Yiddish](images/projectCreateTzotzil.png)

### Vernacular and Analysis Languages

### Import existing Data
The _vernacular language_ is the language for which words are being collected. This is usually a local, indigenous,
minority, autochthonous, heritage, or endangered langauge or dialect.

The _analysis language_ is the language into which the vernacular language is being translated. This is usually a
regional, national, official, or majority language of the location where the vernacular is used.

### Import Existing Data

If you have linguistics data in a [LIFT](https://software.sil.org/lifttools) file (likely exported from The Combine,
[WeSay](https://software.sil.org/wesay), [FLEx](https://software.sil.org/fieldworks), or
[Lexique Pro](software.sil.org/lexiquepro)), you can hit the BROWSE button next to "Upload .zip project file?" to import
the data into your project.

## Manage a Project

Expand All @@ -33,8 +46,8 @@ and associated with new data entries.

Currently, only one LIFT file can be imported per project.

After clicking the Export button, you can navigate to other parts of the website. A notification will appear in the App
Bar when the export is ready for download. A project that has reached hundreds of MB is size may take tens of minutes to
After clicking the Export button, you can navigate to other parts of the website. A download icon will appear in the App
Bar when the export is ready for download. A project that has reached hundreds of MB in size may take tens of minutes to
export.

### Autocomplete
Expand Down