diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c87b85e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "files.exclude": { + "amplify/.config": true, + "amplify/**/*-parameters.json": true, + "amplify/**/amplify.state": true, + "amplify/**/transform.conf.json": true, + "amplify/#current-cloud-backend": true, + "amplify/backend/amplify-meta.json": true, + "amplify/backend/awscloudformation": true + } +} \ No newline at end of file diff --git a/amplify/README.md b/amplify/README.md new file mode 100644 index 0000000..7c0a9e2 --- /dev/null +++ b/amplify/README.md @@ -0,0 +1,8 @@ +# Getting Started with Amplify CLI +This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli). + +Helpful resources: +- Amplify documentation: https://docs.amplify.aws +- Amplify CLI documentation: https://docs.amplify.aws/cli +- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files +- Join Amplify's community: https://amplify.aws/community/ diff --git a/amplify/hooks/README.md b/amplify/hooks/README.md new file mode 100644 index 0000000..8fb601e --- /dev/null +++ b/amplify/hooks/README.md @@ -0,0 +1,7 @@ +# Command Hooks + +Command hooks can be used to run custom scripts upon Amplify CLI lifecycle events like pre-push, post-add-function, etc. + +To get started, add your script files based on the expected naming convention in this directory. + +Learn more about the script file naming convention, hook parameters, third party dependencies, and advanced configurations at https://docs.amplify.aws/cli/usage/command-hooks diff --git a/amplify/hooks/post-push.sh.sample b/amplify/hooks/post-push.sh.sample new file mode 100644 index 0000000..20df3f3 --- /dev/null +++ b/amplify/hooks/post-push.sh.sample @@ -0,0 +1,24 @@ +# This is a sample hook script created by Amplify CLI. +# To start using this post-push hook please change the filename: +# post-push.sh.sample -> post-push.sh +# +# learn more: https://docs.amplify.aws/cli/usage/command-hooks + +if [ -z "$(which jq)" ]; then + echo "Please install jq to run the sample script." + exit 0 +fi + +parameters=`cat` +error=$(jq -r '.error // empty' <<< "$parameters") +data=$(jq -r '.data' <<< "$parameters") + +# +# Write code here: +# +if [ ! -z "$error" ]; then + echo "Amplify CLI emitted an error:" $(jq -r '.message' <<< "$error") + exit 0 +fi +echo "project root path:" $(pwd); +echo "Amplify CLI command:" $(jq -r '.amplify | .command' <<< "$data") \ No newline at end of file diff --git a/amplify/hooks/pre-push.js.sample b/amplify/hooks/pre-push.js.sample new file mode 100644 index 0000000..402e8f9 --- /dev/null +++ b/amplify/hooks/pre-push.js.sample @@ -0,0 +1,27 @@ +/** + * This is a sample hook script created by Amplify CLI. + * To start using this pre-push hook please change the filename: + * pre-push.js.sample -> pre-push.js + * + * learn more: https://docs.amplify.aws/cli/usage/command-hooks + */ + +/** + * @param data { { amplify: { environment: string, command: string, subCommand: string, argv: string[] } } } + * @param error { { message: string, stack: string } } + */ +const hookHandler = async (data, error) => { + // TODO write your hook handler here +}; + +const getParameters = async () => { + const fs = require("fs"); + return JSON.parse(fs.readFileSync(0, { encoding: "utf8" })); +}; + +getParameters() + .then((event) => hookHandler(event.data, event.error)) + .catch((err) => { + console.error(err); + process.exitCode = 1; + }); diff --git a/src/Authenticator.js b/src/Authenticator.js index ca7f982..8703d66 100644 --- a/src/Authenticator.js +++ b/src/Authenticator.js @@ -32,18 +32,18 @@ class Authenticator extends React.Component {

this.switchState('showSignUp')} {...css(styles.toggle)} - >Need an account? Sign Up

+ >新規登録

this.switchState('showForgotPassword')} {...css(styles.toggle)} - >Forgot your password?

+ >パスワードをお忘れですか?

) : (

this.switchState('showSignIn')} - >Already have an account? Sign In

+ >すでにアカウントをお持ちの方はこちら

) } diff --git a/src/Container.js b/src/Container.js index 71b2e70..10ec745 100644 --- a/src/Container.js +++ b/src/Container.js @@ -11,7 +11,6 @@ function Container({ children }) { const styles = { container: { - width: 900, margin: '0 auto', '& h1': { textAlign: 'left' diff --git a/src/ForgotPassword.js b/src/ForgotPassword.js index e38ea18..85d4cb8 100644 --- a/src/ForgotPassword.js +++ b/src/ForgotPassword.js @@ -39,15 +39,14 @@ class ForgotPassword extends React.Component { { !this.state.showConfirmation && (
-

Forgot Password?

this.onChange('username', evt.target.value)} {...css(styles.input)} - placeholder='username' + placeholder='メールアドレス又は電話番号' />
-

Get Authentication Code

+

認証コードを送る

) @@ -58,16 +57,16 @@ class ForgotPassword extends React.Component { this.onChange('confirmationCode', evt.target.value)} {...css(styles.input)} - placeholder='Confirmation Code' + placeholder='認証コード' /> this.onChange('password', evt.target.value)} {...css(styles.input)} type='password' - placeholder='New Password' + placeholder='新しいパスワード' />
-

Reset Password

+

パスワードの再設定

) diff --git a/src/Header.js b/src/Header.js index 538e5ea..054e30c 100644 --- a/src/Header.js +++ b/src/Header.js @@ -10,31 +10,27 @@ class Header extends React.Component { const isLoaded = this.context.isLoaded return (
- - -

AWS Amplify Auth Starter

-
- -

Home

- - -

Private

- { isLoaded ? isAuthenticated ? ( - -

Profile

- + <> + +

検索

+ + +

掲示板

+ + +

メール

+ + ) : ( -

Sign In

+

ログイン

) : null } +
) @@ -56,7 +52,7 @@ const styles = { navContainer: { display: 'flex', flex: 1, - paddingLeft: 50, + paddingLeft: 10, marginTop: 6 }, link: { @@ -72,7 +68,7 @@ const styles = { } }, container: { - height: '80px', + height: '50px', alignItems: 'center', width: '100%', backgroundColor: '#FF9900', diff --git a/src/Private.js b/src/Private.js index b7af2b4..243e9ab 100644 --- a/src/Private.js +++ b/src/Private.js @@ -1,15 +1,120 @@ import React from 'react' - +import { css } from 'glamor' import Container from './Container' +import UserContext from './UserContext' class Private extends React.Component { + state = { + message: '', + receiverID: '' + } + + static contextType = UserContext + + sendMsg = () => { + // var docClient = new AWS.DynamoDB.DocumentClient(); + // var params = { + // TableName: Chatting001, + // Item:{ + // identityId: identityId, // ★prime partition key + // email: _self.state.email, + // username: _self.state.username, + // filename: filepath, + // thumbnail: thumbnail, + // type: fileType, + // title: title, + // story: story, + // imageOverwrite: _self.state.imageOverwrite, + // mapUse: _self.state.mapUse, + // position: _self.state.position, + // uploadTime: uploadTime, // ★prime & secondary sort key + // uploadDate: uploadDate, + // partitionYear: partitionYear, //★secondary partition key + // refCounter: 0 + // } + // }; + // docClient.put(params, function(err, data) { + // if(err) { + // console.log("Err: table put :" +err); + // } else { + // console.log("Success: table put ok"); + // } + // }); + } + + onChange = (key, value) => { + this.props.updateErrorMessage(null) + this.setState({ + [key]: value + }) + } + render() { return ( -

Private Route

+

メッセージ

+ +
+ { +
+ this.onChange('message', evt.target.value)} + {...css(styles.input)} + placeholder='メッセージ' + /> +
+

送信

+
+
+ } +
) } } +const styles = { + button: { + padding: '10px 60px', + backgroundColor: '#ffb102', + marginTop: 10, + marginBottom: 10, + cursor: 'pointer', + borderRadius: '30px', + ':hover': { + backgroundColor: '#ffbb22' + } + }, + buttonText: { + margin: 0, + color: 'white' + }, + input: { + height: 40, + marginBottom: '10px', + border: 'none', + outline: 'none', + borderBottom: '2px solid #ffb102', + fontSize: '16px', + '::placeholder': { + color: 'rgba(0, 0, 0, .3)' + } + }, + container: { + flex: 1, + paddingTop: '15px', + display: 'flex', + flexDirection: 'column', + alignItems: 'center' + }, + formContainer: { + padding: 20, + width: 400, + display: 'flex', + flexDirection: 'column', + boxShadow: "0px 0px 2px rgba(0, 0, 0, .2)", + borderRadius: 20 + } +} + export default Private diff --git a/src/SignIn.js b/src/SignIn.js index cfb781d..306f573 100644 --- a/src/SignIn.js +++ b/src/SignIn.js @@ -49,21 +49,20 @@ class SignIn extends React.Component { { !this.state.showConfirmation && (
-

Sign In

this.onChange('username', evt.target.value)} {...css(styles.input)} - placeholder='username' + placeholder='ユーザー名' /> this.onChange('password', evt.target.value)} {...css(styles.input)} - placeholder='password' + placeholder='パスワード' />
-

Sign In

+

ログイン

) @@ -71,13 +70,14 @@ class SignIn extends React.Component { { this.state.showConfirmation && (
+

Sign In

this.onChange('authCode', evt.target.value)} {...css(styles.input)} - placeholder='Confirmation Code' + placeholder='認証コード' />
-

Confirm Sign In

+

ログイン

) diff --git a/src/SignUp.js b/src/SignUp.js index 65a0783..114dd53 100644 --- a/src/SignUp.js +++ b/src/SignUp.js @@ -46,21 +46,21 @@ class SignUp extends React.Component { { !showConfirmation && (
-

Sign Up

+

新規登録

this.onChange('username', evt.target.value)} /> this.onChange('password', evt.target.value)} /> this.onChange('email', evt.target.value)} /> {/* @@ -71,7 +71,7 @@ class SignUp extends React.Component { onChange={evt => this.onChange('phone_number', evt.target.value)} /> */}
-

Sign Up

+

新規登録

) @@ -79,13 +79,14 @@ class SignUp extends React.Component { { showConfirmation && (
+

認証コード入力

this.onChange('authCode', evt.target.value)} {...css(styles.input)} - placeholder='Confirmation Code' + placeholder='認証コード' />
-

Confirm Sign Up

+

登録する

)