Compare commits
	
		
			4 commits
		
	
	
		
			ad0076156b
			...
			b2d8c1bb2e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
							 | 
						b2d8c1bb2e | ||
| 
							 | 
						bece50643f | ||
| 
							 | 
						47e36a354b | ||
| 
							 | 
						d66bc8ffe1 | 
					 4 changed files with 61 additions and 28 deletions
				
			
		
							
								
								
									
										5
									
								
								src/material/AppTopBar.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/material/AppTopBar.css
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					.AppTopBar {
 | 
				
			||||||
 | 
					  & > .toolbar {
 | 
				
			||||||
 | 
					    padding-top: var(--safe-area-inset-top, 0px);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										31
									
								
								src/material/AppTopBar.tsx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/material/AppTopBar.tsx
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,31 @@
 | 
				
			||||||
 | 
					import { AppBar, Toolbar } from "@suid/material";
 | 
				
			||||||
 | 
					import { splitProps, type JSX, type ParentComponent } from "solid-js";
 | 
				
			||||||
 | 
					import "./AppTopBar.css";
 | 
				
			||||||
 | 
					import { useWindowSize } from "@solid-primitives/resize-observer";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const AppTopBar: ParentComponent<{
 | 
				
			||||||
 | 
					  class?: string;
 | 
				
			||||||
 | 
					  style?: JSX.HTMLAttributes<HTMLElement>["style"];
 | 
				
			||||||
 | 
					}> = (oprops) => {
 | 
				
			||||||
 | 
					  const [props, rest] = splitProps(oprops, ["children", "class"]);
 | 
				
			||||||
 | 
					  const windowSize = useWindowSize();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return (
 | 
				
			||||||
 | 
					    <AppBar
 | 
				
			||||||
 | 
					      class={`AppTopBar ${props.class || ""}`}
 | 
				
			||||||
 | 
					      elevation={1}
 | 
				
			||||||
 | 
					      position="static"
 | 
				
			||||||
 | 
					      {...rest}
 | 
				
			||||||
 | 
					    >
 | 
				
			||||||
 | 
					      <Toolbar
 | 
				
			||||||
 | 
					        variant={windowSize.width > windowSize.height ? "dense" : "regular"}
 | 
				
			||||||
 | 
					        class="toolbar"
 | 
				
			||||||
 | 
					        sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
 | 
				
			||||||
 | 
					      >
 | 
				
			||||||
 | 
					        {props.children}
 | 
				
			||||||
 | 
					      </Toolbar>
 | 
				
			||||||
 | 
					    </AppBar>
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default AppTopBar;
 | 
				
			||||||
| 
						 | 
					@ -29,6 +29,10 @@ import TootList from "./TootList";
 | 
				
			||||||
import "./TootBottomSheet.css";
 | 
					import "./TootBottomSheet.css";
 | 
				
			||||||
import { useNavigator } from "~platform/StackedRouter";
 | 
					import { useNavigator } from "~platform/StackedRouter";
 | 
				
			||||||
import BackButton from "~platform/BackButton";
 | 
					import BackButton from "~platform/BackButton";
 | 
				
			||||||
 | 
					import ItemSelectionProvider, {
 | 
				
			||||||
 | 
					  createSingluarItemSelection,
 | 
				
			||||||
 | 
					} from "./toots/ItemSelectionProvider";
 | 
				
			||||||
 | 
					import AppTopBar from "~material/AppTopBar";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let cachedEntry: [string, mastodon.v1.Status] | undefined;
 | 
					let cachedEntry: [string, mastodon.v1.Status] | undefined;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,13 +48,11 @@ function getCache(acct: string, id: string) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TootBottomSheet: Component = (props) => {
 | 
					const TootBottomSheet: Component = (props) => {
 | 
				
			||||||
  const params = useParams<{ acct: string; id: string }>();
 | 
					  const params = useParams<{ acct: string; id: string }>();
 | 
				
			||||||
  const location = useLocation<{
 | 
					  const { push } = useNavigator();
 | 
				
			||||||
    tootReply?: boolean;
 | 
					 | 
				
			||||||
  }>();
 | 
					 | 
				
			||||||
  const { pop, push } = useNavigator();
 | 
					 | 
				
			||||||
  const time = createTimeSource();
 | 
					  const time = createTimeSource();
 | 
				
			||||||
  const acctText = () => decodeURIComponent(params.acct);
 | 
					  const acctText = () => decodeURIComponent(params.acct);
 | 
				
			||||||
  const session = useSessionForAcctStr(acctText);
 | 
					  const session = useSessionForAcctStr(acctText);
 | 
				
			||||||
 | 
					  const [, selectionState] = createSingluarItemSelection();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [remoteToot, { mutate: setRemoteToot }] = createResource(
 | 
					  const [remoteToot, { mutate: setRemoteToot }] = createResource(
 | 
				
			||||||
    () => [session().client, params.id] as const,
 | 
					    () => [session().client, params.id] as const,
 | 
				
			||||||
| 
						 | 
					@ -247,25 +249,18 @@ const TootBottomSheet: Component = (props) => {
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <Scaffold
 | 
					    <Scaffold
 | 
				
			||||||
      topbar={
 | 
					      topbar={
 | 
				
			||||||
        <AppBar
 | 
					        <AppTopBar
 | 
				
			||||||
          sx={{
 | 
					          style={{
 | 
				
			||||||
            backgroundColor: "var(--tutu-color-surface)",
 | 
					            "background-color": "var(--tutu-color-surface)",
 | 
				
			||||||
            color: "var(--tutu-color-on-surface)",
 | 
					            color: "var(--tutu-color-on-surface)",
 | 
				
			||||||
          }}
 | 
					          }}
 | 
				
			||||||
          elevation={1}
 | 
					 | 
				
			||||||
          position="static"
 | 
					 | 
				
			||||||
        >
 | 
					        >
 | 
				
			||||||
          <Toolbar
 | 
					          <BackButton color="inherit" />
 | 
				
			||||||
            variant="dense"
 | 
					          <Title component="div" class="name" use:solid-styled>
 | 
				
			||||||
            sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
 | 
					            <span innerHTML={tootDisplayName() ?? "Someone"}></span>
 | 
				
			||||||
          >
 | 
					            <span>'s toot</span>
 | 
				
			||||||
            <BackButton color="inherit" />
 | 
					          </Title>
 | 
				
			||||||
            <Title component="div" class="name" use:solid-styled>
 | 
					        </AppTopBar>
 | 
				
			||||||
              <span innerHTML={tootDisplayName() ?? "Someone"}></span>
 | 
					 | 
				
			||||||
              <span>'s toot</span>
 | 
					 | 
				
			||||||
            </Title>
 | 
					 | 
				
			||||||
          </Toolbar>
 | 
					 | 
				
			||||||
        </AppBar>
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      class="TootBottomSheet"
 | 
					      class="TootBottomSheet"
 | 
				
			||||||
    >
 | 
					    >
 | 
				
			||||||
| 
						 | 
					@ -322,11 +317,13 @@ const TootBottomSheet: Component = (props) => {
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
          </Show>
 | 
					          </Show>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          <TootList
 | 
					          <ItemSelectionProvider value={selectionState}>
 | 
				
			||||||
            threads={descendants.list}
 | 
					            <TootList
 | 
				
			||||||
            onUnknownThread={descendants.getPath}
 | 
					              threads={descendants.list}
 | 
				
			||||||
            onChangeToot={descendants.set}
 | 
					              onUnknownThread={descendants.getPath}
 | 
				
			||||||
          />
 | 
					              onChangeToot={descendants.set}
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
 | 
					          </ItemSelectionProvider>
 | 
				
			||||||
        </TimeSourceProvider>
 | 
					        </TimeSourceProvider>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </Scaffold>
 | 
					    </Scaffold>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@ function preventDefault(event: Event) {
 | 
				
			||||||
  event.preventDefault();
 | 
					  event.preventDefault();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type TootContentProps = JSX.HTMLAttributes<HTMLDivElement> & {
 | 
					export type TootContentProps = JSX.HTMLAttributes<HTMLElement> & {
 | 
				
			||||||
  source?: string;
 | 
					  source?: string;
 | 
				
			||||||
  emojis?: mastodon.v1.CustomEmoji[];
 | 
					  emojis?: mastodon.v1.CustomEmoji[];
 | 
				
			||||||
  mentions: mastodon.v1.StatusMention[];
 | 
					  mentions: mastodon.v1.StatusMention[];
 | 
				
			||||||
| 
						 | 
					@ -58,7 +58,7 @@ const TootContent: Component<TootContentProps> = (oprops) => {
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div
 | 
					    <section
 | 
				
			||||||
      ref={(ref) => {
 | 
					      ref={(ref) => {
 | 
				
			||||||
        createRenderEffect(() => {
 | 
					        createRenderEffect(() => {
 | 
				
			||||||
          const finder = clientFinder();
 | 
					          const finder = clientFinder();
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ const TootContent: Component<TootContentProps> = (oprops) => {
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        ></div>
 | 
					        ></div>
 | 
				
			||||||
      </Show>
 | 
					      </Show>
 | 
				
			||||||
    </div>
 | 
					    </section>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue