-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install packages for React, create ReactController #901
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace VocaDb.Web.Controllers | ||
{ | ||
public class ReactController : Controller | ||
{ | ||
public IActionResult Index() | ||
{ | ||
return View(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
import './i18n'; | ||
|
||
const App = (): React.ReactElement => { | ||
return <></>; | ||
}; | ||
|
||
export default App; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import i18n from 'i18next'; | ||
import LanguageDetector from 'i18next-browser-languagedetector'; | ||
import Backend from 'i18next-http-backend'; | ||
import { initReactI18next } from 'react-i18next'; | ||
|
||
i18n | ||
.use(Backend) | ||
.use(LanguageDetector) | ||
.use(initReactI18next) | ||
.init({ | ||
load: 'languageOnly', | ||
fallbackLng: 'en', | ||
|
||
interpolation: { | ||
escapeValue: false, | ||
}, | ||
|
||
react: { | ||
useSuspense: false, | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
import App from './App'; | ||
|
||
const app = document.getElementById('app'); | ||
|
||
ReactDOM.render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
app, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@using System.Globalization | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: Some features in this file are not yet implemented. |
||
@using VocaDb.Model.DataContracts.Users | ||
@using VocaDb.Model.Domain.Globalization | ||
@using VocaDb.Model.Helpers | ||
@using VocaDb.Model.Utils | ||
@using VocaDb.Web.Models.Shared | ||
@inherits VocaDbPage | ||
@addTagHelper *, VocaDb.ReMikus | ||
|
||
@{ | ||
Layout = null; | ||
|
||
var stylesheet = Login.IsLoggedIn && !string.IsNullOrEmpty(Login.User.Stylesheet) ? Login.User.Stylesheet : Config.SiteSettings.DefaultStylesheet; | ||
} | ||
|
||
<!DOCTYPE html> | ||
<html lang="@InterfaceLanguage.GetAvailableLanguageCode(CultureInfo.CurrentUICulture)"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vocaloid Database</title> | ||
|
||
<link rel="shortcut icon" href="@(Config.Assets.FavIconUrl.EmptyToNull() ?? Url.Content("~/Content/favicon.ico"))" type="image/x-icon" /> | ||
<remikus path="/Content/css.css" /> | ||
@if (!string.IsNullOrEmpty(stylesheet)) | ||
{ | ||
<link href="@Url.Content("~/Content/Styles/" + stylesheet)" rel="stylesheet" type="text/css" /> | ||
} | ||
<link href="@Url.Content("~/Content/Styles/Icons.css")" rel="stylesheet" type="text/css" /> | ||
<link href="@Url.Content("~/Content/themes/redmond/jquery-ui-1.10.1.custom.min.css")" rel="stylesheet" type="text/css" /> | ||
<link href="@Url.Content("~/Scripts/qTip/jquery.qtip.css")" rel="stylesheet" type="text/css" /> | ||
<link rel="search" type="application/opensearchdescription+xml" title="@BrandableStrings.SiteName" href="@Config.SiteSettings.OpenSearchPath" /> | ||
|
||
<partial name="Partials/_GoogleAnalytics" /> | ||
</head> | ||
<body class="vdb"> | ||
<div id="app"></div> | ||
<script>window.vdb = @ToJS(new { Values = new GlobalValues(this) })</script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
<remikus path="/bundles/manifest.js" /> | ||
<remikus path="/bundles/vendor.js" /> | ||
<remikus path="/bundles/index.js" /> | ||
Comment on lines
+39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Powered by ReMikus. :) |
||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
ReactController
controller will handle requests to the React app, which will simply serve the single page in the React app.