Skip to content

medienhaus/medienhaus-dev-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

medienhaus/

Customizable, modular, free and open-source environment for decentralized, distributed communication and collaboration without third-party dependencies.

WebsiteFediverse


medienhaus-dev-tools 🔧

Development and maintenance tools for matrix rooms and spaces.

/leave lets you leave every space or room with a given name.
/space event lets you add a state event with a given name to a given room.
/createStructure lets you create a nested matrix spaces tree based on a json file

Static Next.js React front-facing interface

Deployment as static website

Clone git repository and run npm run build.
This will create a folder called 'out' with the static website

Installation

npm install

Installs all of the application’s dependencies.

Configuration

Configuration happens in the next.config.js file.

Available scripts

In the project directory, you can run:

npm run dev

Runs the application in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm run export

Builds a production-ready version of the application and exports it to the out directory.
The build is minified and the filenames include the hashes.

Notes

When wrapping a <Link> from next/link within a styled-component, the as prop provided by styled will collide with the Link's as prop and cause styled-components to throw an "Invalid tag" error. To avoid this, you can either use the recommended forwardedAs prop from styled-components or use a different named prop to pass to a styled Link.

Click to expand workaround example

components/StyledLink.js

import Link from 'next/link'
import styled from 'styled-components'

const StyledLink = ({ as, children, className, href }) => (
  <Link href={href} as={as} passHref>
    <a className={className}>{children}</a>
  </Link>
)

export default styled(StyledLink)`
  color: #0075e0;
  text-decoration: none;
  transition: all 0.2s ease-in-out;

  &:hover {
    color: #40a9ff;
  }

  &:focus {
    color: #40a9ff;
    outline: none;
    border: 0;
  }
`

pages/index.js

import StyledLink from '../components/StyledLink'

export default () => (
  <StyledLink href="/post/[pid]" forwardedAs="/post/abc">
    First post
  </StyledLink>
)

create Structure

The Create Structure Route is expecting a json file as an array of objects with following keys :

  • name – String
  • template – String
  • type – String
  • parentNames – Array of Strings
  • persons – Array of Objects
    • name – String
    • mail – String

Example:

[
  {
    "name": "root context name",
    "template": "root",
    "type": "context",
    "parentNames": [
      ""
    ],
    "persons": [
      {
        "name": "Firstname Lastname",
        "mail": "firstname-lastname@example.org"
      }
    ]
  },
  {
    "name": "sub context name",
    "template": "sub",
    "type": "context",
    "parentNames": [
      "root context name"
    ],
    "persons": [
      {
        "name": "Some-Other Name",
        "mail": "some-other-name@example.org"
      }
    ]
  }
]

CLI Tools

createStructure CLI Tool

Usage

  1. Clone or download the repository.
  2. Install Node.js.
  3. Run the tool with your structure file, matrix base_url, matrix server_name, and access_token.
node ./cli/createStructure.js \
  -f ./examples/structure.example.json \
  -b https://matrix.example.org \
  -s example.org \
  -t syt_access_token_foo_bar_baz_etc_lorem_ipsum \
  1. The tool will create the nested matrix spaces based on the input data.
  2. The output JSON can be used for further usage.

For help, use:

node ./cli/createStructure.js -h

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •