From de18121a9832e80f7aaf0618a2ce5086c3e35e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 27 Oct 2020 22:04:38 +0100 Subject: [PATCH] Move Button into widgets --- webapp/src/components/boardComponent.tsx | 2 +- webapp/src/components/cardDetail.tsx | 2 +- webapp/src/components/dialog.tsx | 3 +- webapp/src/components/viewTitle.tsx | 3 +- webapp/src/pages/homePage.tsx | 69 ------------------- webapp/src/pages/loginPage.tsx | 2 +- .../buttons}/button.scss | 0 .../buttons}/button.tsx | 0 8 files changed, 5 insertions(+), 76 deletions(-) delete mode 100644 webapp/src/pages/homePage.tsx rename webapp/src/{components => widgets/buttons}/button.scss (100%) rename webapp/src/{components => widgets/buttons}/button.tsx (100%) diff --git a/webapp/src/components/boardComponent.tsx b/webapp/src/components/boardComponent.tsx index f070a02dd..fe3b65d42 100644 --- a/webapp/src/components/boardComponent.tsx +++ b/webapp/src/components/boardComponent.tsx @@ -16,10 +16,10 @@ import Menu from '../widgets/menu' import MenuWrapper from '../widgets/menuWrapper' import OptionsIcon from '../widgets/icons/options' import AddIcon from '../widgets/icons/add' +import Button from '../widgets/buttons/button' import BoardCard from './boardCard' import {BoardColumn} from './boardColumn' -import Button from './button' import {CardDialog} from './cardDialog' import {Editable} from './editable' import RootPortal from './rootPortal' diff --git a/webapp/src/components/cardDetail.tsx b/webapp/src/components/cardDetail.tsx index 5f78af089..5022cc60e 100644 --- a/webapp/src/components/cardDetail.tsx +++ b/webapp/src/components/cardDetail.tsx @@ -14,8 +14,8 @@ import {Utils} from '../utils' import MenuWrapper from '../widgets/menuWrapper' import Menu from '../widgets/menu' import Editable from '../widgets/editable' +import Button from '../widgets/buttons/button' -import Button from './button' import {MarkdownEditor} from './markdownEditor' import ContentBlock from './contentBlock' import CommentsList from './commentsList' diff --git a/webapp/src/components/dialog.tsx b/webapp/src/components/dialog.tsx index e0bdd8716..380e16f61 100644 --- a/webapp/src/components/dialog.tsx +++ b/webapp/src/components/dialog.tsx @@ -3,8 +3,7 @@ import React from 'react' import MenuWrapper from '../widgets/menuWrapper' - -import Button from './button' +import Button from '../widgets/buttons/button' import './dialog.scss' diff --git a/webapp/src/components/viewTitle.tsx b/webapp/src/components/viewTitle.tsx index 3cc7e50a3..8d0eed370 100644 --- a/webapp/src/components/viewTitle.tsx +++ b/webapp/src/components/viewTitle.tsx @@ -9,8 +9,7 @@ import mutator from '../mutator' import Menu from '../widgets/menu' import MenuWrapper from '../widgets/menuWrapper' import Editable from '../widgets/editable' - -import Button from './button' +import Button from '../widgets/buttons/button' import './viewTitle.scss' diff --git a/webapp/src/pages/homePage.tsx b/webapp/src/pages/homePage.tsx deleted file mode 100644 index 146afbf92..000000000 --- a/webapp/src/pages/homePage.tsx +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. -import React from 'react' - -import {Archiver} from '../archiver' -import {MutableBoard} from '../blocks/board' -import Button from '../components/button' -import octoClient from '../octoClient' -import {IBlock} from '../blocks/block' -import {Utils} from '../utils' - -type Props = {} - -type State = { - boards: IBlock[] -} - -export default class HomePage extends React.Component { - constructor(props: Props) { - super(props) - this.state = { - boards: [], - } - } - - componentDidMount() { - this.loadBoards() - } - - loadBoards = async () => { - const boards = await octoClient.getBlocksWithType('board') - this.setState({boards}) - } - - importClicked = async () => { - Archiver.importFullArchive(() => { - this.loadBoards() - }) - } - - exportClicked = async () => { - Archiver.exportFullArchive() - } - - addClicked = async () => { - const board = new MutableBoard() - await octoClient.insertBlock(board) - } - - render(): React.ReactNode { - return ( -
- -
- -
- - {this.state.boards.map((board) => ( -

- - {board.title} - {Utils.displayDate(new Date(board.updateAt))} - -

- ))} -
- ) - } -} diff --git a/webapp/src/pages/loginPage.tsx b/webapp/src/pages/loginPage.tsx index 857a85000..113c0c300 100644 --- a/webapp/src/pages/loginPage.tsx +++ b/webapp/src/pages/loginPage.tsx @@ -4,7 +4,7 @@ import React from 'react' import {Utils} from '../utils' -import Button from '../components/button' +import Button from '../widgets/buttons/button' import './loginPage.scss' diff --git a/webapp/src/components/button.scss b/webapp/src/widgets/buttons/button.scss similarity index 100% rename from webapp/src/components/button.scss rename to webapp/src/widgets/buttons/button.scss diff --git a/webapp/src/components/button.tsx b/webapp/src/widgets/buttons/button.tsx similarity index 100% rename from webapp/src/components/button.tsx rename to webapp/src/widgets/buttons/button.tsx