mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-05 04:34:37 +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 InfoDropdown from "./components/InfoDropdown";
|
||||
import UserAccountDropdown from "./components/UserAccountDropdown";
|
||||
import withExtras from 'react-hijack';
|
||||
import addonsConfig from '../../componentLoader/config';
|
||||
import massageConfiguration from '../../componentLoader/massageConfiguration';
|
||||
import componentLoader from '../../componentLoader';
|
||||
// Ignore so Heroku builds pass
|
||||
//import withExtras from 'react-hijack';
|
||||
//import addonsConfig from '../../componentLoader/config';
|
||||
//import massageConfiguration from '../../componentLoader/massageConfiguration';
|
||||
//import componentLoader from '../../componentLoader';
|
||||
|
||||
const StyledNavbar = styled(Navbar)`
|
||||
background-color: ${WHITE_COLOR};
|
||||
|
@ -151,9 +152,12 @@ Navigation.propTypes = {
|
|||
|
||||
// Map the states from store to component props
|
||||
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
|
||||
COMPONENTS_ROOT = "#{TARGET_ROOT}/components".freeze
|
||||
UBER_CONFIG_PATH = "#{TARGET_ROOT}/availableAddons.js".freeze
|
||||
|
||||
begin
|
||||
# clear previous build
|
||||
FileUtils.rm_f Dir.glob("#{COMPONENTS_ROOT}/*")
|
||||
FileUtils.rm_f Dir.glob(UBER_CONFIG_PATH)
|
||||
File.new(UBER_CONFIG_PATH, 'w+')
|
||||
enabled_addons = []
|
||||
|
||||
Dir.foreach('addons/') do |path|
|
||||
addons_client_root = "addons/#{path}/client"
|
||||
next unless Dir.exist? addons_client_root
|
||||
File.open(UBER_CONFIG_PATH, 'w') do |file|
|
||||
file.puts("import #{path} from \'./components/#{path}/config.js\';")
|
||||
end
|
||||
enabled_addons << "#{path}"
|
||||
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(/\"/, '')} };")
|
||||
end
|
||||
|
||||
# handles error on the platforms that does not support symlink
|
||||
# http://ruby-doc.org/core-2.2.0/File.html#symlink-method
|
||||
rescue
|
||||
puts '[sciNote] Unable to load React components from addons!'
|
||||
puts '[sciNote] Your system does not support symlink!'
|
||||
end
|
||||
# Ignoring so Heroku builds pass
|
||||
#TARGET_ROOT = "#{Dir.pwd}/app/javascript/src/componentLoader".freeze
|
||||
#COMPONENTS_ROOT = "#{TARGET_ROOT}/components".freeze
|
||||
#UBER_CONFIG_PATH = "#{TARGET_ROOT}/availableAddons.js".freeze
|
||||
#
|
||||
#begin
|
||||
## clear previous build
|
||||
#FileUtils.rm_f Dir.glob("#{COMPONENTS_ROOT}/*")
|
||||
#FileUtils.rm_f Dir.glob(UBER_CONFIG_PATH)
|
||||
#File.new(UBER_CONFIG_PATH, 'w+')
|
||||
#enabled_addons = []
|
||||
#
|
||||
#Dir.foreach('addons/') do |path|
|
||||
# addons_client_root = "addons/#{path}/client"
|
||||
# next unless Dir.exist? addons_client_root
|
||||
# File.open(UBER_CONFIG_PATH, 'w') do |file|
|
||||
# file.puts("import #{path} from \'./components/#{path}/config.js\';")
|
||||
# end
|
||||
# enabled_addons << "#{path}"
|
||||
# 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(/\"/, '')} };")
|
||||
#end
|
||||
#
|
||||
## handles error on the platforms that does not support symlink
|
||||
## http://ruby-doc.org/core-2.2.0/File.html#symlink-method
|
||||
#rescue
|
||||
# puts '[sciNote] Unable to load React components from addons!'
|
||||
# puts '[sciNote] Your system does not support symlink!'
|
||||
#end
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
"react-data-grid": "^2.0.2",
|
||||
"react-document-title": "^2.0.3",
|
||||
"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-redux": "^0.6.0",
|
||||
"react-moment": "^0.6.4",
|
||||
|
|
Loading…
Add table
Reference in a new issue