mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
open correct viewer for each type and reorder the structure
This commit is contained in:
@@ -22,7 +22,7 @@ class DownloadViewer extends React.Component<Props, State> {
|
|||||||
componentDidMount() {}
|
componentDidMount() {}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return null;
|
return "DownloadViewer";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ class ImageViewer extends React.Component<Props, State> {
|
|||||||
componentDidMount() {}
|
componentDidMount() {}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return null;
|
return "ImageViewer";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import { apiClient } from "@scm-manager/ui-components";
|
import { apiClient } from "../../../../../../scm-ui-components/packages/ui-components/src/index";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
t: string => string
|
t: string => string
|
||||||
@@ -23,7 +23,7 @@ class SourcecodeViewer extends React.Component<Props, State> {
|
|||||||
componentDidMount() {}
|
componentDidMount() {}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return null;
|
return "sourceCodeViewer";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,11 +1,20 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import { apiClient } from "@scm-manager/ui-components";
|
import { apiClient } from "../../../../../scm-ui-components/packages/ui-components/src/index";
|
||||||
import { getSources } from "../../sources/modules/sources";
|
import { getSources } from "../modules/sources";
|
||||||
import type { Repository, File } from "@scm-manager/ui-types";
|
import type {
|
||||||
import { ErrorNotification, Loading } from "@scm-manager/ui-components";
|
Repository,
|
||||||
|
File
|
||||||
|
} from "../../../../../scm-ui-components/packages/ui-types/src/index";
|
||||||
|
import {
|
||||||
|
ErrorNotification,
|
||||||
|
Loading
|
||||||
|
} from "../../../../../scm-ui-components/packages/ui-components/src/index";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import ImageViewer from "../components/content/ImageViewer";
|
||||||
|
import SourcecodeViewer from "../components/content/SourcecodeViewer";
|
||||||
|
import DownloadViewer from "../components/content/DownloadViewer";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
t: string => string,
|
t: string => string,
|
||||||
@@ -49,8 +58,15 @@ class Content extends React.Component<Props, State> {
|
|||||||
if (!file) {
|
if (!file) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
if (contentType.startsWith("image")) {
|
||||||
|
return <ImageViewer />;
|
||||||
|
}
|
||||||
|
|
||||||
return this.state.contentType;
|
if (contentType.startsWith("text")) {
|
||||||
|
return <SourcecodeViewer />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <DownloadViewer />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
isFetchBranchesPending
|
isFetchBranchesPending
|
||||||
} from "../../modules/branches";
|
} from "../../modules/branches";
|
||||||
import { compose } from "redux";
|
import { compose } from "redux";
|
||||||
import Content from "../../content/components/Content";
|
import Content from "./Content";
|
||||||
import { fetchSources, isDirectory } from "../modules/sources";
|
import { fetchSources, isDirectory } from "../modules/sources";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
Reference in New Issue
Block a user