- {topics.map((topic: ForumTopicData, idx: number) => {
- const postStart = ForumUtils.getPost(topic.topic_first_post_id);
- const postLast = ForumUtils.getPost(topic.topic_last_post_id);
+ {topics.map((topic: D3ForumTopicData, idx: number) => {
+ const postStart = D3ForumUtils.getPost(name, topic.topic_first_post_id);
+ const postLast = D3ForumUtils.getPost(name, topic.topic_last_post_id);
if (postStart === null || postLast === null) {
return null;
}
const postTitleStart = Functions.mlang(postStart.subject, lang);
const imageTopic = topic.topic_invisible !== 0 ? imageTopicInvisible : topic.topic_sticky !== 0 ? imageTopicSticky0 : imageTopic10;
const evenodd = idx % 2 === 0 ? 'even' : 'odd';
- const poster = (post: ForumPostData) => {
+ const poster = (post: D3ForumPostData) => {
const title = Functions.mlang(post.subject, lang);
return (
<>
{moment(new Date(post.post_time * 1000)).format('YYYY/M/D')}
- {post.uid_uname}
+ {post.uid_uname}
>
);
}
@@ -90,7 +91,7 @@ const ForumForum = (props: Props) => {
{topic.topic_solved === 0 && }
{topic.topic_locked !== 0 && }
- {postTitleStart}
+ {postTitleStart}
|
{topic.topic_posts_count - 1} |
@@ -118,9 +119,9 @@ const ForumForum = (props: Props) => {
= {Functions.mlang('[en]Marked[/en][ja]未解決トピック[/ja]', lang)}
-
+
>
);
}
-export default ForumForum;
+export default D3ForumForum;
diff --git a/src/d3forum/D3ForumPost.tsx b/src/d3forum/D3ForumPost.tsx
new file mode 100644
index 0000000..d22a518
--- /dev/null
+++ b/src/d3forum/D3ForumPost.tsx
@@ -0,0 +1,80 @@
+import React from 'react';
+import Helmet from 'react-helmet';
+import { RouteComponentProps } from 'react-router';
+import { Link } from 'react-router-dom';
+import PageNotFound from '../common/lib/PageNotFound';
+import { MultiLang } from '../config';
+import Functions from '../functions';
+import ForumJump from './lib/ForumJump';
+import D3ForumUtils, { D3ForumPostSortOrder, D3ForumPostData } from './lib/D3ForumUtils';
+import Post from './lib/Post';
+import PostsTree from './lib/PostsTree';
+
+interface Params {
+ id: string;
+}
+
+interface Props extends RouteComponentProps {
+ lang: MultiLang;
+ name: string;
+}
+
+const D3ForumPost = (props: Props) => {
+ const { lang, name } = props;
+ const params = props.match.params;
+ if (params.id === '') {
+ return ;
+ }
+ const postId = parseInt(props.match.params.id, 10);
+ const post = D3ForumUtils.getPost(name, postId);
+ if (post === null) {
+ return ;
+ }
+ const topic = D3ForumUtils.getTopic(name, post.topic_id);
+ if (topic === null) {
+ return ;
+ }
+ const forum = D3ForumUtils.getForum(name, topic.forum_id);
+ if (forum === null) {
+ return ;
+ }
+ const category = D3ForumUtils.getCategory(name, forum.cat_id);
+ if (category === null) {
+ return ;
+ }
+ const posts = D3ForumUtils.getPosts(name, topic.topic_id, D3ForumPostSortOrder.TREE);
+ const idx = posts.findIndex((post: D3ForumPostData) => {
+ return post.post_id === postId;
+ });
+ const prevPostId = idx <= 0 ? 0 : posts[idx - 1].post_id;
+ const nextPostId = (idx + 1) === posts.length ? 0 : posts[idx + 1].post_id;
+ const title = Functions.mlang(post.subject, lang);
+ return (
+ <>
+
+ {title} - {D3ForumUtils.getTitle(name, lang)} - {Functions.siteTitle(lang)}
+
+
+ {Functions.mlang('[en]Top[/en][ja]トップ[/ja]', lang)}
+ >
+ {Functions.mlang(category.cat_title, lang)}
+ >
+ {Functions.mlang(forum.forum_title, lang)}
+ >
+ {Functions.mlang(topic.topic_title, lang)}
+
+ {title}
+
+
+
+ {Functions.mlang('[en]List posts in the topic[/en][ja]このトピックの投稿一覧へ[/ja]', lang)}
+
+
+
+ >
+ );
+}
+
+export default D3ForumPost;
diff --git a/src/forum/ForumTop.tsx b/src/d3forum/D3ForumTop.tsx
similarity index 75%
rename from src/forum/ForumTop.tsx
rename to src/d3forum/D3ForumTop.tsx
index c27361d..8bd7191 100644
--- a/src/forum/ForumTop.tsx
+++ b/src/d3forum/D3ForumTop.tsx
@@ -8,29 +8,32 @@ import imageCategory1 from './assets/images/category_1.gif';
import imageForum0 from './assets/images/forum_0.gif';
import imageForum1 from './assets/images/forum_1.gif';
import ForumJump from './lib/ForumJump';
-import ForumUtils, { ForumCategoryData, ForumForumData } from './lib/ForumUtils';
+import D3ForumUtils, { D3ForumCategoryData, D3ForumForumData } from './lib/D3ForumUtils';
+import XoopsCode from '../common/lib/XoopsCode';
+import PageNotFound from '../common/lib/PageNotFound';
export interface Props {
lang: MultiLang;
+ name: string;
}
-interface ForumTopSubCategoryProps extends Props {
+interface D3ForumTopSubCategoryProps extends Props {
catId: number;
}
-interface ForumTopForumProps extends Props {
+interface D3ForumTopForumProps extends Props {
catId: number;
}
-const ForumTopForum = (props: ForumTopForumProps) => {
- const { catId, lang } = props;
+const D3ForumTopForum = (props: D3ForumTopForumProps) => {
+ const { lang, name, catId } = props;
const LABEL_HEADER_TITLE = Functions.mlang('[en]Forum[/en][ja]フォーラム[/ja]', lang);
const LABEL_TOPICS = Functions.mlang('[en]Topics[/en][ja]トピック数[/ja]', lang);
const LABEL_POSTS = Functions.mlang('[en]Posts[/en][ja]投稿数[/ja]', lang);
const LABEL_LATEST_POST = Functions.mlang('[en]Latest post[/en][ja]最新投稿[/ja]', lang);
- const forums = ForumUtils.getForums(catId).map((forum: ForumForumData) => {
+ const forums = D3ForumUtils.getForums(name, catId).map((forum: D3ForumForumData) => {
const title = Functions.mlang(forum.forum_title, lang);
- const url = ForumUtils.getForumUrl(forum.forum_id);
+ const url = D3ForumUtils.getForumUrl(name, forum.forum_id);
const image = forum.forum_posts_count === 0 ? imageForum0 : imageForum1;
const latest = forum.forum_last_post_time === 0 ? '' : ', ' + LABEL_LATEST_POST + ': ' + moment(new Date(forum.forum_last_post_time * 1000)).format('Y/M/D H:m');
return (
@@ -54,15 +57,15 @@ const ForumTopForum = (props: ForumTopForumProps) => {
);
}
-const ForumTopSubCategory = (props: ForumTopSubCategoryProps) => {
- const { catId, lang } = props;
+const D3ForumTopSubCategory = (props: D3ForumTopSubCategoryProps) => {
+ const { lang, name, catId } = props;
const LABEL_HEADER_TITLE = Functions.mlang('[en]Subcategories[/en][ja]サブカテゴリ[/ja]', lang);
const LABEL_TOTAL_TOPICS = Functions.mlang('[en]Total topics[/en][ja]総トピック数[/ja]', lang);
const LABEL_TOTAL_POSTS = Functions.mlang('[en]Total posts[/en][ja]総投稿数[/ja]', lang);
const LABEL_LATEST_POST = Functions.mlang('[en]Latest post[/en][ja]最新投稿[/ja]', lang);
- const subCategories = ForumUtils.getSubCategories(catId).map((category: ForumCategoryData) => {
+ const subCategories = D3ForumUtils.getSubCategories(name, catId).map((category: D3ForumCategoryData) => {
const title = Functions.mlang(category.cat_title, lang);
- const url = ForumUtils.getCategoryUrl(category.cat_id);
+ const url = D3ForumUtils.getCategoryUrl(name, category.cat_id);
const image = category.cat_posts_count === 0 ? imageCategory0 : imageCategory1;
const latest = category.cat_last_post_time === 0 ? '' : ', ' + LABEL_LATEST_POST + ': ' + moment(new Date(category.cat_last_post_time * 1000)).format('Y/M/D H:m');
return (
@@ -86,15 +89,15 @@ const ForumTopSubCategory = (props: ForumTopSubCategoryProps) => {
);
}
-const ForumTopCategory = (props: Props) => {
- const { lang } = props;
+const D3ForumTopCategory = (props: Props) => {
+ const { lang, name } = props;
const LABEL_TOTAL_TOPICS = Functions.mlang('[en]Total topics[/en][ja]総トピック数[/ja]', lang);
const LABEL_TOTAL_POSTS = Functions.mlang('[en]Total posts[/en][ja]総投稿数[/ja]', lang);
const LABEL_LATEST_POST = Functions.mlang('[en]Latest post[/en][ja]最新投稿[/ja]', lang);
- const categories = ForumUtils.getCategories().map((category: ForumCategoryData) => {
+ const categories = D3ForumUtils.getCategories(name).map((category: D3ForumCategoryData) => {
const title = Functions.mlang(category.cat_title, lang);
const image = category.cat_posts_count === 0 ? imageCategory0 : imageCategory1;
- const url = ForumUtils.getCategoryUrl(category.cat_id);
+ const url = D3ForumUtils.getCategoryUrl(name, category.cat_id);
const latest = category.cat_last_post_time === 0 ? '' : ', ' + LABEL_LATEST_POST + ': ' + moment(new Date(category.cat_last_post_time * 1000)).format('Y/M/D H:m');
return (
@@ -104,8 +107,8 @@ const ForumTopCategory = (props: Props) => {
{LABEL_TOTAL_TOPICS}: {category.cat_topics_count}, {LABEL_TOTAL_POSTS}: {category.cat_posts_count}{latest}
-
-
+
+
@@ -121,25 +124,26 @@ const ForumTopCategory = (props: Props) => {
);
}
-const ForumTop = (props: Props) => {
- const { lang } = props;
+const D3ForumTop = (props: Props) => {
+ const { lang, name } = props;
const LABEL_TOTAL_TOPICS = Functions.mlang('[en]Total topics:[/en][ja]総トピック数:[/ja]', lang);
const LABEL_TOTAL_POSTS = Functions.mlang('[en]Total posts:[/en][ja]総投稿数:[/ja]', lang);
const LABEL_NEW_POSTS = Functions.mlang('[en]New posts[/en][ja]新しい投稿があります[/ja]', lang);
const LABEL_NO_NEW_POSTS = Functions.mlang('[en]No new posts[/en][ja]新しい投稿はありません[/ja]', lang);
- const totalTopics = ForumUtils.getTotalTopics();
- const totalPosts = ForumUtils.getTotalPosts();
+ const d3forum = D3ForumUtils.getModule(name);
+ if (d3forum === null) {
+ return ;
+ }
return (
- フォーラムトップ
- 興味のあるフォーラムへぜひご参加ください
+
- {LABEL_TOTAL_TOPICS}
- - {totalTopics},
+ - {D3ForumUtils.getTotalTopics(name)},
- {LABEL_TOTAL_POSTS}
- - {totalPosts}
+ - {D3ForumUtils.getTotalPosts(name)}
-
+
= {LABEL_NEW_POSTS}
@@ -149,9 +153,9 @@ const ForumTop = (props: Props) => {
-
+
);
}
-export default ForumTop;
+export default D3ForumTop;
diff --git a/src/d3forum/D3ForumTopic.tsx b/src/d3forum/D3ForumTopic.tsx
new file mode 100644
index 0000000..2cd3e95
--- /dev/null
+++ b/src/d3forum/D3ForumTopic.tsx
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import Helmet from 'react-helmet';
+import { RouteComponentProps } from 'react-router';
+import { HashLink } from 'react-router-hash-link';
+import Loading from '../common/lib/Loading';
+import PageNotFound from '../common/lib/PageNotFound';
+import { MultiLang } from '../config';
+import Functions from '../functions';
+import D3ForumUtils, { D3ForumCategoryData, D3ForumForumData, D3ForumPostData, D3ForumPostSortOrder, D3ForumTopicData } from './lib/D3ForumUtils';
+import ForumJump from './lib/ForumJump';
+import Post from './lib/Post';
+import PostsTree from './lib/PostsTree';
+
+interface Params {
+ id: string;
+}
+
+interface Props extends RouteComponentProps {
+ lang: MultiLang;
+ name: string;
+}
+
+interface State {
+ loading: boolean;
+ name: string;
+ topicId: number;
+ order: D3ForumPostSortOrder;
+}
+
+class D3ForumTopic extends Component {
+
+ private topic: D3ForumTopicData | null = null;
+ private forum: D3ForumForumData | null = null;
+ private category: D3ForumCategoryData | null = null;
+ private posts: D3ForumPostData[] = [];
+
+ constructor(props: Props) {
+ super(props);
+ const { name } = props;
+ this.state = {
+ loading: true,
+ name: name,
+ topicId: 0,
+ order: D3ForumPostSortOrder.TREE,
+ };
+ }
+
+ static getDerivedStateFromProps(nextProps: Props, prevState: State) {
+ const params = new URLSearchParams(nextProps.location.search);
+ const topicId = parseInt(nextProps.match.params.id, 10);
+ const order_ = params.get('order');
+ const order = (order_ !== null && order_.match(/(0|1|2)/)) ? parseInt(order_, 10) as D3ForumPostSortOrder : D3ForumPostSortOrder.TREE;
+ if (nextProps.name !== prevState.name || prevState.topicId !== topicId || prevState.order !== order) {
+ return { loading: true, name: nextProps.name, topicId, order };
+ }
+ return null;
+ }
+
+ componentDidMount() {
+ this.load();
+ }
+
+ componentDidUpdate() {
+ this.load();
+ }
+
+ load() {
+ const { name } = this.props;
+ if (this.state.loading) {
+ this.topic = D3ForumUtils.getTopic(name, this.state.topicId);
+ this.forum = D3ForumUtils.getForum(name, this.topic === null ? 0 : this.topic.forum_id);
+ this.category = D3ForumUtils.getCategory(name, this.forum === null ? 0 : this.forum.cat_id);
+ this.posts = D3ForumUtils.getPosts(name, this.state.topicId, this.state.order);
+ this.setState({ loading: false });
+ }
+ }
+
+ render() {
+ const { lang, name } = this.props;
+ if (this.state.loading) {
+ return ;
+ }
+ if (this.topic === null || this.forum === null || this.category === null) {
+ return ;
+ }
+ const orderCtrl = (
+
+
+ {this.state.order !== D3ForumPostSortOrder.TREE && {Functions.mlang('[en]Tree order[/en][ja]ツリー構造順で表示[/ja]', lang)}}
+ {this.state.order !== D3ForumPostSortOrder.OLD && {Functions.mlang('[en]Older is upper[/en][ja]投稿の古いものから[/ja]', lang)}}
+ {this.state.order !== D3ForumPostSortOrder.NEW && {Functions.mlang('[en]Newer is upper[/en][ja]投稿の新しいものから[/ja]', lang)}}
+
+
+ );
+ const title = Functions.mlang(this.topic.topic_title, lang);
+ return (
+ <>
+
+ {title} - {D3ForumUtils.getTitle(name, lang)} - {Functions.siteTitle(lang)}
+
+
+ {Functions.mlang('[en]Top[/en][ja]トップ[/ja]', lang)}
+ >
+ {Functions.mlang(this.category.cat_title, lang)}
+ >
+ {Functions.mlang(this.forum.forum_title, lang)}
+
+ {title}
+
+ {orderCtrl}
+
+ {this.posts.map((post, idx) => {
+ const prevPostId = idx === 0 ? 0 : this.posts[idx - 1].post_id;
+ const nextPostId = (idx + 1) === this.posts.length ? 0 : this.posts[idx + 1].post_id;
+ return ;
+ })}
+
+ {orderCtrl}
+
+ >
+ );
+ }
+}
+
+export default D3ForumTopic;
diff --git a/src/d3forum/D3ForumXoopsPathRedirect.tsx b/src/d3forum/D3ForumXoopsPathRedirect.tsx
new file mode 100644
index 0000000..d737999
--- /dev/null
+++ b/src/d3forum/D3ForumXoopsPathRedirect.tsx
@@ -0,0 +1,65 @@
+import React, { Component } from 'react';
+import { Redirect, RouteComponentProps, withRouter } from 'react-router';
+import PageNotFound from '../common/lib/PageNotFound';
+import { MultiLang } from '../config';
+import Functions from '../functions';
+
+interface Props extends RouteComponentProps {
+ lang: MultiLang;
+ name: string;
+}
+
+class D3ForumXoopsPathRedirect extends Component {
+
+ getRedirectUrl(): string {
+ const { name, location } = this.props;
+ const pathname = location.pathname || '';
+ const hash = location.hash || '';
+ const query = new URLSearchParams(location.search);
+ const search = new RegExp(`^/modules/${name}(?:/+(.*))?$`);
+ const matches = pathname.match(search);
+ if (matches === null) {
+ return '';
+ }
+ const path = matches[1] || '';
+ switch (path) {
+ case '':
+ case 'index.php': {
+ const catId = query.get('cat_id');
+ if (catId !== null && catId.match(/^\d+$/) !== null) {
+ return '/' + name + '/category/' + Functions.escape(catId);
+ }
+ const forumId = query.get('forum_id');
+ if (forumId !== null && forumId.match(/^\d+$/) !== null) {
+ return '/' + name + '/forum/' + Functions.escape(forumId);
+ }
+ const topicId = query.get('topic_id');
+ if (topicId !== null && topicId.match(/^\d+$/) !== null) {
+ const matches = hash.match(/^#post_id(\d+)$/);
+ return '/' + name + '/topic/' + Functions.escape(topicId) + (matches === null ? '' : '#postId' + matches[1]);
+ }
+ const postId = query.get('post_id');
+ if (postId !== null && postId.match(/^\d+$/) !== null) {
+ return '/' + name + '/post/' + Functions.escape(postId);
+ }
+ const catIds = query.get('cat_ids');
+ if (catIds !== null && catIds.match(/^\d+$/) !== null) {
+ return '/' + name + '/category/' + Functions.escape(catIds);
+ }
+ return '/' + name + '/';
+ }
+ }
+ return '/' + name + '/' + path;
+ }
+
+ render() {
+ const { lang } = this.props;
+ const url = this.getRedirectUrl();
+ if (url === '') {
+ return ;
+ }
+ return ;
+ }
+}
+
+export default withRouter(D3ForumXoopsPathRedirect);
diff --git a/src/forum/assets/d3forum_common.css b/src/d3forum/assets/d3forum_common.css
similarity index 100%
rename from src/forum/assets/d3forum_common.css
rename to src/d3forum/assets/d3forum_common.css
diff --git a/src/forum/assets/d3forum_main.css b/src/d3forum/assets/d3forum_main.css
similarity index 100%
rename from src/forum/assets/d3forum_main.css
rename to src/d3forum/assets/d3forum_main.css
diff --git a/src/forum/assets/images/category_0.gif b/src/d3forum/assets/images/category_0.gif
similarity index 100%
rename from src/forum/assets/images/category_0.gif
rename to src/d3forum/assets/images/category_0.gif
diff --git a/src/forum/assets/images/category_1.gif b/src/d3forum/assets/images/category_1.gif
similarity index 100%
rename from src/forum/assets/images/category_1.gif
rename to src/d3forum/assets/images/category_1.gif
diff --git a/src/forum/assets/images/forum_0.gif b/src/d3forum/assets/images/forum_0.gif
similarity index 100%
rename from src/forum/assets/images/forum_0.gif
rename to src/d3forum/assets/images/forum_0.gif
diff --git a/src/forum/assets/images/forum_1.gif b/src/d3forum/assets/images/forum_1.gif
similarity index 100%
rename from src/forum/assets/images/forum_1.gif
rename to src/d3forum/assets/images/forum_1.gif
diff --git a/src/forum/assets/images/posticon0.gif b/src/d3forum/assets/images/posticon0.gif
similarity index 100%
rename from src/forum/assets/images/posticon0.gif
rename to src/d3forum/assets/images/posticon0.gif
diff --git a/src/forum/assets/images/posticon1.gif b/src/d3forum/assets/images/posticon1.gif
similarity index 100%
rename from src/forum/assets/images/posticon1.gif
rename to src/d3forum/assets/images/posticon1.gif
diff --git a/src/forum/assets/images/posticon2.gif b/src/d3forum/assets/images/posticon2.gif
similarity index 100%
rename from src/forum/assets/images/posticon2.gif
rename to src/d3forum/assets/images/posticon2.gif
diff --git a/src/forum/assets/images/posticon3.gif b/src/d3forum/assets/images/posticon3.gif
similarity index 100%
rename from src/forum/assets/images/posticon3.gif
rename to src/d3forum/assets/images/posticon3.gif
diff --git a/src/forum/assets/images/posticon4.gif b/src/d3forum/assets/images/posticon4.gif
similarity index 100%
rename from src/forum/assets/images/posticon4.gif
rename to src/d3forum/assets/images/posticon4.gif
diff --git a/src/forum/assets/images/posticon5.gif b/src/d3forum/assets/images/posticon5.gif
similarity index 100%
rename from src/forum/assets/images/posticon5.gif
rename to src/d3forum/assets/images/posticon5.gif
diff --git a/src/forum/assets/images/posticon6.gif b/src/d3forum/assets/images/posticon6.gif
similarity index 100%
rename from src/forum/assets/images/posticon6.gif
rename to src/d3forum/assets/images/posticon6.gif
diff --git a/src/forum/assets/images/posticon7.gif b/src/d3forum/assets/images/posticon7.gif
similarity index 100%
rename from src/forum/assets/images/posticon7.gif
rename to src/d3forum/assets/images/posticon7.gif
diff --git a/src/forum/assets/images/topic_01.gif b/src/d3forum/assets/images/topic_01.gif
similarity index 100%
rename from src/forum/assets/images/topic_01.gif
rename to src/d3forum/assets/images/topic_01.gif
diff --git a/src/forum/assets/images/topic_10.gif b/src/d3forum/assets/images/topic_10.gif
similarity index 100%
rename from src/forum/assets/images/topic_10.gif
rename to src/d3forum/assets/images/topic_10.gif
diff --git a/src/forum/assets/images/topic_11.gif b/src/d3forum/assets/images/topic_11.gif
similarity index 100%
rename from src/forum/assets/images/topic_11.gif
rename to src/d3forum/assets/images/topic_11.gif
diff --git a/src/forum/assets/images/topic_invisible.gif b/src/d3forum/assets/images/topic_invisible.gif
similarity index 100%
rename from src/forum/assets/images/topic_invisible.gif
rename to src/d3forum/assets/images/topic_invisible.gif
diff --git a/src/forum/assets/images/topic_status_locked1.gif b/src/d3forum/assets/images/topic_status_locked1.gif
similarity index 100%
rename from src/forum/assets/images/topic_status_locked1.gif
rename to src/d3forum/assets/images/topic_status_locked1.gif
diff --git a/src/forum/assets/images/topic_status_marked1.gif b/src/d3forum/assets/images/topic_status_marked1.gif
similarity index 100%
rename from src/forum/assets/images/topic_status_marked1.gif
rename to src/d3forum/assets/images/topic_status_marked1.gif
diff --git a/src/forum/assets/images/topic_status_solved0.gif b/src/d3forum/assets/images/topic_status_solved0.gif
similarity index 100%
rename from src/forum/assets/images/topic_status_solved0.gif
rename to src/d3forum/assets/images/topic_status_solved0.gif
diff --git a/src/forum/assets/images/topic_sticky0.gif b/src/d3forum/assets/images/topic_sticky0.gif
similarity index 100%
rename from src/forum/assets/images/topic_sticky0.gif
rename to src/d3forum/assets/images/topic_sticky0.gif
diff --git a/src/forum/lib/CategoryJump.tsx b/src/d3forum/lib/CategoryJump.tsx
similarity index 77%
rename from src/forum/lib/CategoryJump.tsx
rename to src/d3forum/lib/CategoryJump.tsx
index 05cb402..f0f380e 100644
--- a/src/forum/lib/CategoryJump.tsx
+++ b/src/d3forum/lib/CategoryJump.tsx
@@ -2,35 +2,36 @@ import React from 'react';
import { RouteComponentProps, withRouter } from 'react-router-dom';
import { MultiLang } from '../../config';
import Functions from '../../functions';
-import ForumUtils, { ForumCategoryData } from './ForumUtils';
+import D3ForumUtils, { D3ForumCategoryData } from './D3ForumUtils';
interface Props extends RouteComponentProps {
lang: MultiLang;
+ name: string;
catId: number;
}
export const CategoryJump = (props: Props) => {
- const { lang, catId } = props;
+ const { lang, name, catId } = props;
const LABEL_TOP = Functions.mlang('[en]Top[/en][ja]トップ[/ja]', lang);
const LABE_SUBMIT = Functions.mlang('[en]Jump to a category[/en][ja]カテゴリージャンプ[/ja]', lang);
const catSelect = React.createRef();
const catSelectOptions: JSX.Element[] = [
];
- const catSelectLoop = (categories: ForumCategoryData[]) => {
+ const catSelectLoop = (categories: D3ForumCategoryData[]) => {
categories.forEach((category) => {
const title = Functions.mlang(category.cat_title, lang);
const depth = category.cat_depth_in_tree !== 0 ? '--'.repeat(category.cat_depth_in_tree) + ' ' : '';
catSelectOptions.push();
- catSelectLoop(ForumUtils.getSubCategories(category.cat_id));
+ catSelectLoop(D3ForumUtils.getSubCategories(name, category.cat_id));
});
};
- catSelectLoop(ForumUtils.getCategories());
+ catSelectLoop(D3ForumUtils.getCategories(name));
return ( |