starting to add explorer

This commit is contained in:
Sebastian Jambor 2023-01-25 21:34:01 +01:00
parent dbe589f983
commit 7be872a0b4
8 changed files with 90 additions and 7 deletions
app/javascript/mastodon/features
activity_log
activitypub_explorer
ui
config
package.jsonyarn.lock

View file

@ -8,8 +8,7 @@ import ColumnHeader from 'mastodon/components/column_header';
import { HotKeys } from 'react-hotkeys';
import DismissableBanner from 'mastodon/components/dismissable_banner';
import ActivityPubVisualization from 'activitypub-visualization';
import { ActivityPubVisualization } from 'activitypub-visualization';
const mapStateToProps = (state) => {
return {

View file

@ -0,0 +1,69 @@
import React from 'react';
import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import Column from 'mastodon/components/column';
import ColumnHeader from 'mastodon/components/column_header';
import { HotKeys } from 'react-hotkeys';
import DismissableBanner from 'mastodon/components/dismissable_banner';
import { ActivityPubExplorer as Explorer } from 'activitypub-visualization';
const mapStateToProps = (state) => {
return {
logs: state.getIn(['activity_log', 'logs']),
};
};
export default @connect(mapStateToProps)
class ActivityPubExplorer extends ImmutablePureComponent {
static propTypes = {
multiColumn: PropTypes.bool,
};
handleHeaderClick = () => {
this.column.scrollTop();
}
setRef = c => {
this.column = c;
}
render() {
const { logs, multiColumn } = this.props;
const darkMode = !(document.body && document.body.classList.contains('theme-mastodon-light'));
return (
<Column bindToDocument={!multiColumn} ref={this.setRef} label='ActivityPub Explorer'>
<ColumnHeader
icon='wpexplorer'
title='ActivityPub Explorer'
onClick={this.handleHeaderClick}
multiColumn={multiColumn}
/>
<DismissableBanner id='activity_log'>
<p>
<FormattedMessage
id='dismissable_banner.activity_pub_explorer_information'
defaultMessage='TODO. You can find more information on my {blog}.'
values={{
blog: <a href='//seb.jambor.dev/' style={{ color: darkMode ? '#8c8dff' : '#3a3bff', textDecoration: 'none' }}>blog</a>,
}}
/>
</p>
</DismissableBanner>
<div>Hello world</div>
</Column>
);
}
}

View file

@ -88,6 +88,8 @@ class NavigationPanel extends React.Component {
<ColumnLink transparent to='/activity_log' icon='comments' text='Activity Log' />
<ColumnLink transparent to='/activitypub_explorer' icon='wpexplorer' text='ActivityPub Explorer' />
<ListPanel />
<hr />

View file

@ -49,6 +49,7 @@ import {
PinnedStatuses,
Lists,
ActivityLog,
ActivityPubExplorer,
Directory,
Explore,
FollowRecommendations,
@ -107,6 +108,7 @@ const keyMap = {
goToMuted: 'g m',
goToRequests: 'g r',
goToActivityLog: 'g a',
goToActivityPubExplorer: 'g e',
toggleHidden: 'x',
toggleSensitive: 'h',
openMedia: 'e',
@ -217,6 +219,7 @@ class SwitchingColumnsArea extends React.PureComponent {
<WrappedRoute path='/mutes' component={Mutes} content={children} />
<WrappedRoute path='/lists' component={Lists} content={children} />
<WrappedRoute path='/activity_log' component={ActivityLog} content={children} />
<WrappedRoute path='/activitypub_explorer' component={ActivityPubExplorer} content={children} />
<Route component={BundleColumnError} />
</WrappedSwitch>
@ -492,6 +495,10 @@ class UI extends React.PureComponent {
this.context.router.history.push('/activity_log');
}
handleHotkeyGoToActivityPubExplorer = () => {
this.context.router.history.push('/activitypub_explorer');
}
handleHotkeyGoToNotifications = () => {
this.context.router.history.push('/notifications');
}
@ -550,6 +557,7 @@ class UI extends React.PureComponent {
back: this.handleHotkeyBack,
goToHome: this.handleHotkeyGoToHome,
goToActivityLog: this.handleHotkeyGoToActivityLog,
goToActivityPubExplorer: this.handleHotkeyGoToActivityPubExplorer,
goToNotifications: this.handleHotkeyGoToNotifications,
goToLocal: this.handleHotkeyGoToLocal,
goToFederated: this.handleHotkeyGoToFederated,

View file

@ -42,6 +42,10 @@ export function ActivityLog () {
return import(/* webpackChunkName: "features/activity_log" */'../../activity_log');
}
export function ActivityPubExplorer () {
return import(/* webpackChunkName: "features/activity_log" */'../../activitypub_explorer');
}
export function Status () {
return import(/* webpackChunkName: "features/status" */'../../status');
}

View file

@ -25,6 +25,7 @@ Rails.application.routes.draw do
/publish
/follow_requests
/activity_log
/activitypub_explorer
/blocks
/domain_blocks
/mutes

View file

@ -35,7 +35,7 @@
"@github/webauthn-json": "^0.5.7",
"@rails/ujs": "^6.1.7",
"abortcontroller-polyfill": "^1.7.5",
"activitypub-visualization": "^1.0.0",
"activitypub-visualization": "^1.1.0",
"array-includes": "^3.1.5",
"arrow-key-navigation": "^1.2.0",
"autoprefixer": "^9.8.8",

View file

@ -2322,10 +2322,10 @@ acorn@^8.0.4, acorn@^8.1.0, acorn@^8.5.0, acorn@^8.8.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8"
integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==
activitypub-visualization@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/activitypub-visualization/-/activitypub-visualization-1.0.0.tgz#728ce9a20336bf927980748c37c8b5206cafecac"
integrity sha512-azxnf4POMTsI8J0PiOXeD70wZvxAd6KdcD2YIE+AqkW00Fgg39Jxi+OcImc8GoAiUh7dpFp6nLA+WVH4uVnIEw==
activitypub-visualization@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/activitypub-visualization/-/activitypub-visualization-1.1.0.tgz#db7875657aa3215f6d7be16795964c82c1021efe"
integrity sha512-0DrnCdmpx5551q0vZiQYHu3ZsVVFP0JJKLHQpbLmgetVJxGjRoZC7iwjh+tvyYixBhUneIAhVJ2VH0bugiAwFA==
agent-base@6:
version "6.0.2"