mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +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() {}
|
||||
|
||||
render() {
|
||||
return null;
|
||||
return "DownloadViewer";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class ImageViewer extends React.Component<Props, State> {
|
||||
componentDidMount() {}
|
||||
|
||||
render() {
|
||||
return null;
|
||||
return "ImageViewer";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @flow
|
||||
import React from "react";
|
||||
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 = {
|
||||
t: string => string
|
||||
@@ -23,7 +23,7 @@ class SourcecodeViewer extends React.Component<Props, State> {
|
||||
componentDidMount() {}
|
||||
|
||||
render() {
|
||||
return null;
|
||||
return "sourceCodeViewer";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
// @flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import { getSources } from "../../sources/modules/sources";
|
||||
import type { Repository, File } from "@scm-manager/ui-types";
|
||||
import { ErrorNotification, Loading } from "@scm-manager/ui-components";
|
||||
import { apiClient } from "../../../../../scm-ui-components/packages/ui-components/src/index";
|
||||
import { getSources } from "../modules/sources";
|
||||
import type {
|
||||
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 ImageViewer from "../components/content/ImageViewer";
|
||||
import SourcecodeViewer from "../components/content/SourcecodeViewer";
|
||||
import DownloadViewer from "../components/content/DownloadViewer";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
@@ -49,8 +58,15 @@ class Content extends React.Component<Props, State> {
|
||||
if (!file) {
|
||||
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
|
||||
} from "../../modules/branches";
|
||||
import { compose } from "redux";
|
||||
import Content from "../../content/components/Content";
|
||||
import Content from "./Content";
|
||||
import { fetchSources, isDirectory } from "../modules/sources";
|
||||
|
||||
type Props = {
|
||||
|
||||
Reference in New Issue
Block a user