feat: revamped spotlight (#3171)

Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
Andrew Bastin
2023-07-11 23:02:33 +05:30
committed by GitHub
parent c3531c9d8b
commit 5230d2d3b8
36 changed files with 3941 additions and 1043 deletions

View File

@@ -1,13 +1,38 @@
import { HoppModule } from "."
import { Container } from "dioc"
import { Container, Service } from "dioc"
import { diocPlugin } from "dioc/vue"
import { DebugService } from "~/services/debug.service"
const serviceContainer = new Container()
if (import.meta.env.DEV) {
serviceContainer.bind(DebugService)
}
/**
* Gets a service from the app service container. You can use this function
* to get a service if you have no access to the container or if you are not
* in a component (if you are, you can use `useService`) or if you are not in a
* service.
* @param service The class of the service to get
* @returns The service instance
*
* @deprecated This is a temporary escape hatch for legacy code to access
* services. Please use `useService` if within components or try to convert your
* legacy subsystem into a service if possible.
*/
export function getService<T extends typeof Service<any> & { ID: string }>(
service: T
): InstanceType<T> {
return serviceContainer.bind(service)
}
export default <HoppModule>{
onVueAppInit(app) {
// TODO: look into this
// @ts-expect-error Something weird with Vue versions
app.use(diocPlugin, {
container: new Container(),
container: serviceContainer,
})
},
}

View File

@@ -115,6 +115,14 @@ export const changeAppLanguage = async (locale: string) => {
setLocalConfig("locale", locale)
}
/**
* Returns the i18n instance
*/
export function getI18n() {
// @ts-expect-error Something weird with the i18n errors
return i18nInstance!.global.t
}
export default <HoppModule>{
onVueAppInit(app) {
const i18n = createI18n(<I18nOptions>{