-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ACPD React Conversion]: Setup vite local and add base template with …
…react (#294) * Setup vite local and template with react content * Update Makefile
- Loading branch information
1 parent
f9036d0
commit 86d0fab
Showing
14 changed files
with
96 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
{{ block.super }} | ||
|
||
{% include "./assets_custom.html" %} | ||
{% endblock assets_custom %} | ||
{% endblock assets_custom %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<script type="module" src="/src/main.tsx"></script> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// library.tsx | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import { AdminRegistrations } from './components/Admin/Registrations'; | ||
import { ViewUsers } from './components/Admin/ViewUsers'; | ||
import { AdminSubmissions } from './components/Admin/Submissions'; | ||
import { QueryClient, QueryClientProvider } from 'react-query'; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
function setupComponent(rootId: string, Component: React.ComponentType): void { | ||
const root = document.getElementById(rootId); | ||
if (root) { | ||
ReactDOM.render( | ||
<QueryClientProvider client={queryClient}> | ||
<BrowserRouter> | ||
<Component /> | ||
</BrowserRouter> | ||
</QueryClientProvider>, | ||
root | ||
); | ||
} | ||
} | ||
|
||
// Mapping of element IDs to components | ||
const componentMap: { [key: string]: React.ComponentType } = { | ||
'list-registrations-root': AdminRegistrations, | ||
'view-users-root': ViewUsers, | ||
'list-admin-submissions': AdminSubmissions, | ||
// Add new components with html id in the list above. | ||
}; | ||
|
||
function setupApp(): void { | ||
Object.keys(componentMap).forEach(id => { | ||
const elem = document.getElementById(id); | ||
if (elem) { | ||
setupComponent(id, componentMap[id]); | ||
} | ||
}); | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', setupApp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
CUSTOM_APPS = ['apps.admin_regis_table', 'apps.apcd_login', 'apps.registrations', 'apps.submissions', 'apps.exception', 'apps.admin_submissions', 'apps.admin_extension', 'apps.admin_exception', 'apps.extension', 'apps.submitter_renewals_listing', 'apps.view_users', 'apps.components.paginator', 'apps.utils'] | ||
CUSTOM_MIDDLEWARE = [] | ||
STATICFILES_DIRS = ('taccsite_custom/apcd-cms', 'apps/admin_regis_table', 'apps/submissions', 'apps/exception', 'apps/extension', 'apps/submitter_renewals_listing', 'apps/view_users', 'apps/components/paginator', 'apps/utils', 'client/dist') | ||
STATICFILES_DIRS = ('taccsite_custom/apcd_cms', 'apps/admin_regis_table', 'apps/submissions', 'apps/exception', 'apps/extension', 'apps/submitter_renewals_listing', 'apps/view_users', 'apps/components/paginator', 'apps/utils', 'client/dist') | ||
|
Empty file.
23 changes: 23 additions & 0 deletions
23
apcd-cms/src/taccsite_custom/apcd_cms/templates/standard.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
{% extends "standard.html" %} | ||
{% load cms_tags %} | ||
|
||
{% block assets_custom %} | ||
{{ block.super }} | ||
|
||
{% include "./assets_custom.html" %} | ||
|
||
{% if settings.DEBUG %} | ||
<script type="module"> | ||
import RefreshRuntime from 'http://localhost:3000/@react-refresh'; | ||
RefreshRuntime.injectIntoGlobalHook(window); | ||
window.$RefreshReg$ = () => {}; | ||
window.$RefreshSig$ = () => (type) => type; | ||
window.__vite_plugin_react_preamble_installed__ = true; | ||
</script> | ||
<script type="module" src="http://localhost:3000/@vite/client"></script> | ||
<script type="module" src="http://localhost:3000/src/main.tsx"></script> | ||
{% else %} | ||
{% include "./react-assets.html" %} | ||
{% endif %} | ||
{% endblock assets_custom %} |