mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-15 01:24:53 +08:00
Comment react-hijack code
This commit is contained in:
parent
f67f633562
commit
4ddc7dfa85
3 changed files with 46 additions and 41 deletions
|
@ -16,10 +16,11 @@ import SearchDropdown from "./components/SearchDropdown";
|
||||||
import NotificationsDropdown from "./components/NotificationsDropdown";
|
import NotificationsDropdown from "./components/NotificationsDropdown";
|
||||||
import InfoDropdown from "./components/InfoDropdown";
|
import InfoDropdown from "./components/InfoDropdown";
|
||||||
import UserAccountDropdown from "./components/UserAccountDropdown";
|
import UserAccountDropdown from "./components/UserAccountDropdown";
|
||||||
import withExtras from 'react-hijack';
|
// Ignore so Heroku builds pass
|
||||||
import addonsConfig from '../../componentLoader/config';
|
//import withExtras from 'react-hijack';
|
||||||
import massageConfiguration from '../../componentLoader/massageConfiguration';
|
//import addonsConfig from '../../componentLoader/config';
|
||||||
import componentLoader from '../../componentLoader';
|
//import massageConfiguration from '../../componentLoader/massageConfiguration';
|
||||||
|
//import componentLoader from '../../componentLoader';
|
||||||
|
|
||||||
const StyledNavbar = styled(Navbar)`
|
const StyledNavbar = styled(Navbar)`
|
||||||
background-color: ${WHITE_COLOR};
|
background-color: ${WHITE_COLOR};
|
||||||
|
@ -151,9 +152,12 @@ Navigation.propTypes = {
|
||||||
|
|
||||||
// Map the states from store to component props
|
// Map the states from store to component props
|
||||||
const mapStateToProps = ({ current_team }) => ({ current_team });
|
const mapStateToProps = ({ current_team }) => ({ current_team });
|
||||||
const NavigationWithExtras = withExtras({
|
|
||||||
identifier: 'navigation',
|
|
||||||
config: massageConfiguration(addonsConfig, 'navigation'),
|
|
||||||
}, componentLoader)(Navigation);
|
|
||||||
|
|
||||||
export default connect(mapStateToProps)(NavigationWithExtras);
|
// Ignore so Heroku builds pass
|
||||||
|
//const NavigationWithExtras = withExtras({
|
||||||
|
// identifier: 'navigation',
|
||||||
|
// config: massageConfiguration(addonsConfig, 'navigation'),
|
||||||
|
//}, componentLoader)(Navigation);
|
||||||
|
//
|
||||||
|
//export default connect(mapStateToProps)(NavigationWithExtras);
|
||||||
|
export default connect(mapStateToProps)(Navigation);
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
TARGET_ROOT = "#{Dir.pwd}/app/javascript/src/componentLoader".freeze
|
# Ignoring so Heroku builds pass
|
||||||
COMPONENTS_ROOT = "#{TARGET_ROOT}/components".freeze
|
#TARGET_ROOT = "#{Dir.pwd}/app/javascript/src/componentLoader".freeze
|
||||||
UBER_CONFIG_PATH = "#{TARGET_ROOT}/availableAddons.js".freeze
|
#COMPONENTS_ROOT = "#{TARGET_ROOT}/components".freeze
|
||||||
|
#UBER_CONFIG_PATH = "#{TARGET_ROOT}/availableAddons.js".freeze
|
||||||
begin
|
#
|
||||||
# clear previous build
|
#begin
|
||||||
FileUtils.rm_f Dir.glob("#{COMPONENTS_ROOT}/*")
|
## clear previous build
|
||||||
FileUtils.rm_f Dir.glob(UBER_CONFIG_PATH)
|
#FileUtils.rm_f Dir.glob("#{COMPONENTS_ROOT}/*")
|
||||||
File.new(UBER_CONFIG_PATH, 'w+')
|
#FileUtils.rm_f Dir.glob(UBER_CONFIG_PATH)
|
||||||
enabled_addons = []
|
#File.new(UBER_CONFIG_PATH, 'w+')
|
||||||
|
#enabled_addons = []
|
||||||
Dir.foreach('addons/') do |path|
|
#
|
||||||
addons_client_root = "addons/#{path}/client"
|
#Dir.foreach('addons/') do |path|
|
||||||
next unless Dir.exist? addons_client_root
|
# addons_client_root = "addons/#{path}/client"
|
||||||
File.open(UBER_CONFIG_PATH, 'w') do |file|
|
# next unless Dir.exist? addons_client_root
|
||||||
file.puts("import #{path} from \'./components/#{path}/config.js\';")
|
# File.open(UBER_CONFIG_PATH, 'w') do |file|
|
||||||
end
|
# file.puts("import #{path} from \'./components/#{path}/config.js\';")
|
||||||
enabled_addons << "#{path}"
|
# end
|
||||||
File.symlink("#{Dir.pwd}/#{addons_client_root}", "#{COMPONENTS_ROOT}/#{path}")
|
# enabled_addons << "#{path}"
|
||||||
end
|
# File.symlink("#{Dir.pwd}/#{addons_client_root}", "#{COMPONENTS_ROOT}/#{path}")
|
||||||
|
#end
|
||||||
File.open(UBER_CONFIG_PATH, 'a') do |file|
|
#
|
||||||
file.puts("export default { #{enabled_addons.join(", ").gsub(/\"/, '')} };")
|
#File.open(UBER_CONFIG_PATH, 'a') do |file|
|
||||||
end
|
# file.puts("export default { #{enabled_addons.join(", ").gsub(/\"/, '')} };")
|
||||||
|
#end
|
||||||
# handles error on the platforms that does not support symlink
|
#
|
||||||
# http://ruby-doc.org/core-2.2.0/File.html#symlink-method
|
## handles error on the platforms that does not support symlink
|
||||||
rescue
|
## http://ruby-doc.org/core-2.2.0/File.html#symlink-method
|
||||||
puts '[sciNote] Unable to load React components from addons!'
|
#rescue
|
||||||
puts '[sciNote] Your system does not support symlink!'
|
# puts '[sciNote] Unable to load React components from addons!'
|
||||||
end
|
# puts '[sciNote] Your system does not support symlink!'
|
||||||
|
#end
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
"react-data-grid": "^2.0.2",
|
"react-data-grid": "^2.0.2",
|
||||||
"react-document-title": "^2.0.3",
|
"react-document-title": "^2.0.3",
|
||||||
"react-dom": "15.6.1",
|
"react-dom": "15.6.1",
|
||||||
"react-hijack": "biosistemika/react-hijack#2.0.1",
|
// "react-hijack": "biosistemika/react-hijack#2.0.1", Ignoring so Heroku builds pass
|
||||||
"react-intl": "^2.3.0",
|
"react-intl": "^2.3.0",
|
||||||
"react-intl-redux": "^0.6.0",
|
"react-intl-redux": "^0.6.0",
|
||||||
"react-moment": "^0.6.4",
|
"react-moment": "^0.6.4",
|
||||||
|
|
Loading…
Add table
Reference in a new issue