File tree Expand file tree Collapse file tree 7 files changed +24
-13
lines changed Expand file tree Collapse file tree 7 files changed +24
-13
lines changed Original file line number Diff line number Diff line change 1
- VITE_LIFF_ID = 1656508316-k7jNojXm
1
+ VITE_LIFF_ID = 1656508316-k7jNojXm
2
+
3
+ # TODO
4
+ VITE_LIFF_ID_MINI =
Original file line number Diff line number Diff line change @@ -4,14 +4,15 @@ import styles from './App.module.css'
4
4
import Header from './components/Header'
5
5
import Snippet from './components/Snippet'
6
6
import Input from './components/Input'
7
- import { FilterContext , FilterTypes } from './Context'
7
+ import { FilterContext , FilterType } from './Context'
8
8
import qrCode from './qr-code.png'
9
9
import { SHARE_TARGET_PICKER_FIXED_ARGUMENT_LIST } from './constants'
10
10
11
- const isMINI = new URLSearchParams ( location . search ) . has ( 'mini' )
12
- const filter = isMINI ? FilterTypes . MINI : FilterTypes . LIFF
11
+ type Props = {
12
+ filter : FilterType ;
13
+ } ;
13
14
14
- function App ( ) {
15
+ function App ( { filter } : Props ) {
15
16
let isLoggedIn = false
16
17
try {
17
18
isLoggedIn = liff . isLoggedIn ( )
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
-
3
- export const FilterTypes = {
4
- LIFF : 'LIFF' ,
5
- MINI : 'MINI'
6
- } as const
2
+ import { FilterTypes } from './FilterTypes'
7
3
8
4
export type FilterType = keyof typeof FilterTypes
9
5
Original file line number Diff line number Diff line change
1
+ export const FilterTypes = {
2
+ LIFF : 'LIFF' ,
3
+ MINI : 'MINI'
4
+ } as const
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import Input from './Input'
4
4
import styles from './Snippet.module.css'
5
5
import Tag from './Tag'
6
6
import TextArea from './TextArea'
7
- import { FilterContext , FilterTypes } from '../Context'
7
+ import { FilterContext } from '../Context'
8
+ import { FilterTypes } from '../FilterTypes'
8
9
import Pulldown from './Pulldown'
9
10
10
11
interface SippetProps {
Original file line number Diff line number Diff line change @@ -3,13 +3,18 @@ import React from 'react'
3
3
import ReactDOM from 'react-dom'
4
4
import './main.css'
5
5
import App from './App'
6
+ import { FilterTypes } from './FilterTypes'
7
+
8
+ const isMINI = new URLSearchParams ( location . search ) . has ( 'mini' )
9
+ const filter = isMINI ? FilterTypes . MINI : FilterTypes . LIFF
10
+ const liffId = isMINI ? import . meta. env . VITE_LIFF_ID_MINI : import . meta. env . VITE_LIFF_ID
6
11
7
12
liff
8
- . init ( { liffId : import . meta . env . VITE_LIFF_ID || '' } )
13
+ . init ( { liffId } )
9
14
. then ( ( ) => {
10
15
ReactDOM . render (
11
16
< React . StrictMode >
12
- < App />
17
+ < App filter = { filter } />
13
18
</ React . StrictMode > ,
14
19
document . getElementById ( 'root' )
15
20
)
Original file line number Diff line number Diff line change 2
2
3
3
interface ImportMetaEnv {
4
4
readonly VITE_LIFF_ID : string ;
5
+ readonly VITE_LIFF_ID_MINI : string ;
5
6
}
6
7
7
8
interface ImportMeta {
You can’t perform that action at this time.
0 commit comments